import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int res = 10000;
        for (int i = 0; i < s.length() - t.length() + 1; i++) {
            int c = 0;
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    c++;
                }
            }
            res = Math.min(res, c);
        }
        System.out.println(res);
        sc.close();
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int res = 10000;
        for (int i = 0; i < s.length() - t.length() + 1; i++) {
            int c = 0;
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    c++;
                }
            }
            res = Math.min(res, c);
        }
        System.out.println(res);
        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int res = 10000;
        for (int i = 0; i < s.length() - t.length() + 1; i++) {
            int c = 0;
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    c++;
                }
            }
            res = Math.min(res, c);
        }
        System.out.println(res);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int res = 10000;
        for (int i = 0; i < s.length() - t.length() + 1; i++) {
            int c = 0;
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    c++;
                }
            }
            res = Math.min(res, c);
        }
        System.out.println(res);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc int res = 10000; res 10000 for (int i = 0; i < s.length() - t.length() + 1; i++) {
            int c = 0;
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    c++;
                }
            }
            res = Math.min(res, c);
        } int i = 0; int i = 0; i 0 i < s.length() - t.length() + 1 i s.length() - t.length() + 1 s.length() - t.length() s.length() s.length s t.length() t.length t 1 i++ i++ i {
            int c = 0;
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    c++;
                }
            }
            res = Math.min(res, c);
        } {
            int c = 0;
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    c++;
                }
            }
            res = Math.min(res, c);
        } int c = 0; c 0 for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    c++;
                }
            } int j = 0; int j = 0; j 0 j < t.length() j t.length() t.length t j++ j++ j {
                if (s.charAt(i + j) != t.charAt(j)) {
                    c++;
                }
            } {
                if (s.charAt(i + j) != t.charAt(j)) {
                    c++;
                }
            } if (s.charAt(i + j) != t.charAt(j)) {
                    c++;
                } s.charAt(i + j) != t.charAt(j) s.charAt(i + j) s.charAt s i + j i j t.charAt(j) t.charAt t j {
                    c++;
                } c++ c res = Math.min(res, c) res Math.min(res, c) Math.min Math res c System.out.println(res) System.out.println System.out System System.out res sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int res = 10000;
        for (int i = 0; i < s.length() - t.length() + 1; i++) {
            int c = 0;
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    c++;
                }
            }
            res = Math.min(res, c);
        }
        System.out.println(res);
        sc.close();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int res = 10000;
        for (int i = 0; i < s.length() - t.length() + 1; i++) {
            int c = 0;
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    c++;
                }
            }
            res = Math.min(res, c);
        }
        System.out.println(res);
        sc.close();
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int res = 10000;
        for (int i = 0; i < s.length() - t.length() + 1; i++) {
            int c = 0;
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    c++;
                }
            }
            res = Math.min(res, c);
        }
        System.out.println(res);
        sc.close();
    }
}