import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        String[] t = sc.next().split("");

        int result = t.length;
        for (int i = 0; i <= s.length - t.length; i++) {
            int diff = 0;
            for (int j = 0; j < t.length; j++) {
                if (!t[j].equals(s[i+j])) diff++;
            }
            result = Math.min(result, diff);
        }
        System.out.println(result);
    }
} 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().split("");
        String[] t = sc.next().split("");

        int result = t.length;
        for (int i = 0; i <= s.length - t.length; i++) {
            int diff = 0;
            for (int j = 0; j < t.length; j++) {
                if (!t[j].equals(s[i+j])) diff++;
            }
            result = Math.min(result, diff);
        }
        System.out.println(result);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        String[] t = sc.next().split("");

        int result = t.length;
        for (int i = 0; i <= s.length - t.length; i++) {
            int diff = 0;
            for (int j = 0; j < t.length; j++) {
                if (!t[j].equals(s[i+j])) diff++;
            }
            result = Math.min(result, diff);
        }
        System.out.println(result);
    } main {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        String[] t = sc.next().split("");

        int result = t.length;
        for (int i = 0; i <= s.length - t.length; i++) {
            int diff = 0;
            for (int j = 0; j < t.length; j++) {
                if (!t[j].equals(s[i+j])) diff++;
            }
            result = Math.min(result, diff);
        }
        System.out.println(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] s = sc.next().split(""); s sc.next().split("") sc.next().split sc.next() sc.next sc "" String[] t = sc.next().split(""); t sc.next().split("") sc.next().split sc.next() sc.next sc "" int result = t.length; result t.length t t.length for (int i = 0; i <= s.length - t.length; i++) {
            int diff = 0;
            for (int j = 0; j < t.length; j++) {
                if (!t[j].equals(s[i+j])) diff++;
            }
            result = Math.min(result, diff);
        } int i = 0; int i = 0; i 0 i <= s.length - t.length i s.length - t.length s.length s s.length t.length t t.length i++ i++ i {
            int diff = 0;
            for (int j = 0; j < t.length; j++) {
                if (!t[j].equals(s[i+j])) diff++;
            }
            result = Math.min(result, diff);
        } {
            int diff = 0;
            for (int j = 0; j < t.length; j++) {
                if (!t[j].equals(s[i+j])) diff++;
            }
            result = Math.min(result, diff);
        } int diff = 0; diff 0 for (int j = 0; j < t.length; j++) {
                if (!t[j].equals(s[i+j])) diff++;
            } int j = 0; int j = 0; j 0 j < t.length j t.length t t.length j++ j++ j {
                if (!t[j].equals(s[i+j])) diff++;
            } {
                if (!t[j].equals(s[i+j])) diff++;
            } if (!t[j].equals(s[i+j])) diff++; !t[j].equals(s[i+j]) t[j].equals(s[i+j]) t[j].equals t[j] t j s[i+j] s i+j i j diff++ diff result = Math.min(result, diff) result Math.min(result, diff) Math.min Math result diff System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        String[] t = sc.next().split("");

        int result = t.length;
        for (int i = 0; i <= s.length - t.length; i++) {
            int diff = 0;
            for (int j = 0; j < t.length; j++) {
                if (!t[j].equals(s[i+j])) diff++;
            }
            result = Math.min(result, diff);
        }
        System.out.println(result);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        String[] t = sc.next().split("");

        int result = t.length;
        for (int i = 0; i <= s.length - t.length; i++) {
            int diff = 0;
            for (int j = 0; j < t.length; j++) {
                if (!t[j].equals(s[i+j])) diff++;
            }
            result = Math.min(result, diff);
        }
        System.out.println(result);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        String[] t = sc.next().split("");

        int result = t.length;
        for (int i = 0; i <= s.length - t.length; i++) {
            int diff = 0;
            for (int j = 0; j < t.length; j++) {
                if (!t[j].equals(s[i+j])) diff++;
            }
            result = Math.min(result, diff);
        }
        System.out.println(result);
    }
}
