import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String t = sc.next();
        String s = sc.next();

        ArrayList<Integer> list = new ArrayList<>();

        String hantei;
        for(int i = 0; i <= t.length() - s.length(); i++) {
            hantei = t.substring(i, s.length() + i);
            int c = 0;
            for(int j = 0; j < s.length(); j++)
            	if(s.charAt(j) != hantei.charAt(j)) ++c;
            list.add(c);
        }

        Collections.sort(list);
        System.out.println(list.get(0));
    }

} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.Scanner; Scanner java.util public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String t = sc.next();
        String s = sc.next();

        ArrayList<Integer> list = new ArrayList<>();

        String hantei;
        for(int i = 0; i <= t.length() - s.length(); i++) {
            hantei = t.substring(i, s.length() + i);
            int c = 0;
            for(int j = 0; j < s.length(); j++)
            	if(s.charAt(j) != hantei.charAt(j)) ++c;
            list.add(c);
        }

        Collections.sort(list);
        System.out.println(list.get(0));
    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String t = sc.next();
        String s = sc.next();

        ArrayList<Integer> list = new ArrayList<>();

        String hantei;
        for(int i = 0; i <= t.length() - s.length(); i++) {
            hantei = t.substring(i, s.length() + i);
            int c = 0;
            for(int j = 0; j < s.length(); j++)
            	if(s.charAt(j) != hantei.charAt(j)) ++c;
            list.add(c);
        }

        Collections.sort(list);
        System.out.println(list.get(0));
    } main {
        Scanner sc = new Scanner(System.in);

        String t = sc.next();
        String s = sc.next();

        ArrayList<Integer> list = new ArrayList<>();

        String hantei;
        for(int i = 0; i <= t.length() - s.length(); i++) {
            hantei = t.substring(i, s.length() + i);
            int c = 0;
            for(int j = 0; j < s.length(); j++)
            	if(s.charAt(j) != hantei.charAt(j)) ++c;
            list.add(c);
        }

        Collections.sort(list);
        System.out.println(list.get(0));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String t = sc.next(); t sc.next() sc.next sc String s = sc.next(); s sc.next() sc.next sc ArrayList<Integer> list = new ArrayList<>(); list new ArrayList<>() String hantei; hantei for(int i = 0; i <= t.length() - s.length(); i++) {
            hantei = t.substring(i, s.length() + i);
            int c = 0;
            for(int j = 0; j < s.length(); j++)
            	if(s.charAt(j) != hantei.charAt(j)) ++c;
            list.add(c);
        } int i = 0; int i = 0; i 0 i <= t.length() - s.length() i t.length() - s.length() t.length() t.length t s.length() s.length s i++ i++ i {
            hantei = t.substring(i, s.length() + i);
            int c = 0;
            for(int j = 0; j < s.length(); j++)
            	if(s.charAt(j) != hantei.charAt(j)) ++c;
            list.add(c);
        } {
            hantei = t.substring(i, s.length() + i);
            int c = 0;
            for(int j = 0; j < s.length(); j++)
            	if(s.charAt(j) != hantei.charAt(j)) ++c;
            list.add(c);
        } hantei = t.substring(i, s.length() + i) hantei t.substring(i, s.length() + i) t.substring t i s.length() + i s.length() s.length s i int c = 0; c 0 for(int j = 0; j < s.length(); j++)
            	if(s.charAt(j) != hantei.charAt(j)) ++c; int j = 0; int j = 0; j 0 j < s.length() j s.length() s.length s j++ j++ j if(s.charAt(j) != hantei.charAt(j)) ++c; if(s.charAt(j) != hantei.charAt(j)) ++c; s.charAt(j) != hantei.charAt(j) s.charAt(j) s.charAt s j hantei.charAt(j) hantei.charAt hantei j ++c c list.add(c) list.add list c Collections.sort(list) Collections.sort Collections list System.out.println(list.get(0)) System.out.println System.out System System.out list.get(0) list.get list 0 String[] args args public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String t = sc.next();
        String s = sc.next();

        ArrayList<Integer> list = new ArrayList<>();

        String hantei;
        for(int i = 0; i <= t.length() - s.length(); i++) {
            hantei = t.substring(i, s.length() + i);
            int c = 0;
            for(int j = 0; j < s.length(); j++)
            	if(s.charAt(j) != hantei.charAt(j)) ++c;
            list.add(c);
        }

        Collections.sort(list);
        System.out.println(list.get(0));
    }

} public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String t = sc.next();
        String s = sc.next();

        ArrayList<Integer> list = new ArrayList<>();

        String hantei;
        for(int i = 0; i <= t.length() - s.length(); i++) {
            hantei = t.substring(i, s.length() + i);
            int c = 0;
            for(int j = 0; j < s.length(); j++)
            	if(s.charAt(j) != hantei.charAt(j)) ++c;
            list.add(c);
        }

        Collections.sort(list);
        System.out.println(list.get(0));
    }

} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String t = sc.next();
        String s = sc.next();

        ArrayList<Integer> list = new ArrayList<>();

        String hantei;
        for(int i = 0; i <= t.length() - s.length(); i++) {
            hantei = t.substring(i, s.length() + i);
            int c = 0;
            for(int j = 0; j < s.length(); j++)
            	if(s.charAt(j) != hantei.charAt(j)) ++c;
            list.add(c);
        }

        Collections.sort(list);
        System.out.println(list.get(0));
    }

}
