import java.util.Scanner;

public class Main {

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

        String s = sc.nextLine();
        String t = sc.nextLine();
        int ans = t.length();

        String[] as = s.split("");
        String[] at = t.split("");

        for (int i = 0; i < as.length - at.length + 1; i++) {
            int count = 0;
            for (int j = 0; j < at.length; j++) {
                if (as[i + j].equals(at[j])) {
                    count++;
                }
            }
            int tmp = at.length - count;
            ans = Math.min(ans, tmp);
        }
        System.out.println(ans);
    }
} 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.nextLine();
        String t = sc.nextLine();
        int ans = t.length();

        String[] as = s.split("");
        String[] at = t.split("");

        for (int i = 0; i < as.length - at.length + 1; i++) {
            int count = 0;
            for (int j = 0; j < at.length; j++) {
                if (as[i + j].equals(at[j])) {
                    count++;
                }
            }
            int tmp = at.length - count;
            ans = Math.min(ans, tmp);
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.nextLine();
        String t = sc.nextLine();
        int ans = t.length();

        String[] as = s.split("");
        String[] at = t.split("");

        for (int i = 0; i < as.length - at.length + 1; i++) {
            int count = 0;
            for (int j = 0; j < at.length; j++) {
                if (as[i + j].equals(at[j])) {
                    count++;
                }
            }
            int tmp = at.length - count;
            ans = Math.min(ans, tmp);
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);

        String s = sc.nextLine();
        String t = sc.nextLine();
        int ans = t.length();

        String[] as = s.split("");
        String[] at = t.split("");

        for (int i = 0; i < as.length - at.length + 1; i++) {
            int count = 0;
            for (int j = 0; j < at.length; j++) {
                if (as[i + j].equals(at[j])) {
                    count++;
                }
            }
            int tmp = at.length - count;
            ans = Math.min(ans, tmp);
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String t = sc.nextLine(); t sc.nextLine() sc.nextLine sc int ans = t.length(); ans t.length() t.length t String[] as = s.split(""); as s.split("") s.split s "" String[] at = t.split(""); at t.split("") t.split t "" for (int i = 0; i < as.length - at.length + 1; i++) {
            int count = 0;
            for (int j = 0; j < at.length; j++) {
                if (as[i + j].equals(at[j])) {
                    count++;
                }
            }
            int tmp = at.length - count;
            ans = Math.min(ans, tmp);
        } int i = 0; int i = 0; i 0 i < as.length - at.length + 1 i as.length - at.length + 1 as.length - at.length as.length as as.length at.length at at.length 1 i++ i++ i {
            int count = 0;
            for (int j = 0; j < at.length; j++) {
                if (as[i + j].equals(at[j])) {
                    count++;
                }
            }
            int tmp = at.length - count;
            ans = Math.min(ans, tmp);
        } {
            int count = 0;
            for (int j = 0; j < at.length; j++) {
                if (as[i + j].equals(at[j])) {
                    count++;
                }
            }
            int tmp = at.length - count;
            ans = Math.min(ans, tmp);
        } int count = 0; count 0 for (int j = 0; j < at.length; j++) {
                if (as[i + j].equals(at[j])) {
                    count++;
                }
            } int j = 0; int j = 0; j 0 j < at.length j at.length at at.length j++ j++ j {
                if (as[i + j].equals(at[j])) {
                    count++;
                }
            } {
                if (as[i + j].equals(at[j])) {
                    count++;
                }
            } if (as[i + j].equals(at[j])) {
                    count++;
                } as[i + j].equals(at[j]) as[i + j].equals as[i + j] as i + j i j at[j] at j {
                    count++;
                } count++ count int tmp = at.length - count; tmp at.length - count at.length at at.length count ans = Math.min(ans, tmp) ans Math.min(ans, tmp) Math.min Math ans tmp System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

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

        String s = sc.nextLine();
        String t = sc.nextLine();
        int ans = t.length();

        String[] as = s.split("");
        String[] at = t.split("");

        for (int i = 0; i < as.length - at.length + 1; i++) {
            int count = 0;
            for (int j = 0; j < at.length; j++) {
                if (as[i + j].equals(at[j])) {
                    count++;
                }
            }
            int tmp = at.length - count;
            ans = Math.min(ans, tmp);
        }
        System.out.println(ans);
    }
} public class Main {

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

        String s = sc.nextLine();
        String t = sc.nextLine();
        int ans = t.length();

        String[] as = s.split("");
        String[] at = t.split("");

        for (int i = 0; i < as.length - at.length + 1; i++) {
            int count = 0;
            for (int j = 0; j < at.length; j++) {
                if (as[i + j].equals(at[j])) {
                    count++;
                }
            }
            int tmp = at.length - count;
            ans = Math.min(ans, tmp);
        }
        System.out.println(ans);
    }
} Main
import java.util.Scanner;

public class Main {

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

        String s = sc.nextLine();
        String t = sc.nextLine();
        int ans = t.length();

        String[] as = s.split("");
        String[] at = t.split("");

        for (int i = 0; i < as.length - at.length + 1; i++) {
            int count = 0;
            for (int j = 0; j < at.length; j++) {
                if (as[i + j].equals(at[j])) {
                    count++;
                }
            }
            int tmp = at.length - count;
            ans = Math.min(ans, tmp);
        }
        System.out.println(ans);
    }
}
