
import java.io.PrintWriter;
import java.util.*;

public class Main {
    static Scanner scanner;
    static PrintWriter out;
    public static void main(String[] args) {
        scanner = new Scanner(System.in);
        out = new PrintWriter(System.out);

        char[] line = nextLine().toCharArray();

        char[] second = nextLine().toCharArray();
        int in = line.length - second.length;

        int min = Integer.MAX_VALUE;

        int in2 = second.length;

        for (int i = 0; i <= in; i++) {
            int a = 0;
            for (int j = 0; j < in2; j++) {
                if (line[j+i] != second[j]) {
                    a++;
                }
            }
            if (min >= a) {
                min = a;
            }
        }
        System.out.println(min);

        out.flush();
    }

    public static void println(Object o) {
        out.println(o);
    }

    public static void print(Object o) {
        out.print(o);
    }

    public static void printf(String format, Object... o) {
        out.printf(format, o);
    }

    public static String next() {
        return scanner.next();
    }

    public static int nextInt() {
        return Integer.parseInt(scanner.next());
    }

    public static long nextLong() {
        return Long.parseLong(scanner.next());
    }

    public static double nextDouble() {
        return Double.parseDouble(scanner.next());
    }

    public static short nextShort() {
        return Short.parseShort(scanner.next());
    }

    public static float nextFloat() {
        return Float.parseFloat(scanner.next());
    }

    public static void printYes() {
        System.out.println("Yes");
    }

    public static void printYES() {
        System.out.println("YES");
    }

    public static void printNo() {
        System.out.println("No");
    }

    public static void printNO() {
        System.out.println("NO");
    }

    public static String nextLine() {
        return scanner.nextLine();
    }

    public static double distance(double x, double y, double x2, double y2) {
        return Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y));
    }

    public static int MOD = 1_000_000_007;
    public static int MAX = 100000;
    public static long[] fac = new long[MAX];
    public static long[] finv = new long[MAX];
    public static long[] inv = new long[MAX];

    public static void combinit() {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < MAX; i++) {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }

    public static long combination(int n, int k) {
        if (n < k || n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }

    public static long factorial(long n) {
        return n <= 0 ? 1 : n * factorial(n - 1);
    }
} import java.io.PrintWriter; PrintWriter java.io import java.util.*; util.* java public class Main {
    static Scanner scanner;
    static PrintWriter out;
    public static void main(String[] args) {
        scanner = new Scanner(System.in);
        out = new PrintWriter(System.out);

        char[] line = nextLine().toCharArray();

        char[] second = nextLine().toCharArray();
        int in = line.length - second.length;

        int min = Integer.MAX_VALUE;

        int in2 = second.length;

        for (int i = 0; i <= in; i++) {
            int a = 0;
            for (int j = 0; j < in2; j++) {
                if (line[j+i] != second[j]) {
                    a++;
                }
            }
            if (min >= a) {
                min = a;
            }
        }
        System.out.println(min);

        out.flush();
    }

    public static void println(Object o) {
        out.println(o);
    }

    public static void print(Object o) {
        out.print(o);
    }

    public static void printf(String format, Object... o) {
        out.printf(format, o);
    }

    public static String next() {
        return scanner.next();
    }

    public static int nextInt() {
        return Integer.parseInt(scanner.next());
    }

    public static long nextLong() {
        return Long.parseLong(scanner.next());
    }

    public static double nextDouble() {
        return Double.parseDouble(scanner.next());
    }

    public static short nextShort() {
        return Short.parseShort(scanner.next());
    }

    public static float nextFloat() {
        return Float.parseFloat(scanner.next());
    }

    public static void printYes() {
        System.out.println("Yes");
    }

    public static void printYES() {
        System.out.println("YES");
    }

    public static void printNo() {
        System.out.println("No");
    }

    public static void printNO() {
        System.out.println("NO");
    }

    public static String nextLine() {
        return scanner.nextLine();
    }

    public static double distance(double x, double y, double x2, double y2) {
        return Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y));
    }

    public static int MOD = 1_000_000_007;
    public static int MAX = 100000;
    public static long[] fac = new long[MAX];
    public static long[] finv = new long[MAX];
    public static long[] inv = new long[MAX];

    public static void combinit() {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < MAX; i++) {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }

    public static long combination(int n, int k) {
        if (n < k || n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }

    public static long factorial(long n) {
        return n <= 0 ? 1 : n * factorial(n - 1);
    }
} Main static Scanner scanner; scanner static PrintWriter out; out public static int MOD = 1_000_000_007; MOD 1_000_000_007 public static int MAX = 100000; MAX 100000 public static long[] fac = new long[MAX]; fac new long[MAX] MAX public static long[] finv = new long[MAX]; finv new long[MAX] MAX public static long[] inv = new long[MAX]; inv new long[MAX] MAX public static void main(String[] args) {
        scanner = new Scanner(System.in);
        out = new PrintWriter(System.out);

        char[] line = nextLine().toCharArray();

        char[] second = nextLine().toCharArray();
        int in = line.length - second.length;

        int min = Integer.MAX_VALUE;

        int in2 = second.length;

        for (int i = 0; i <= in; i++) {
            int a = 0;
            for (int j = 0; j < in2; j++) {
                if (line[j+i] != second[j]) {
                    a++;
                }
            }
            if (min >= a) {
                min = a;
            }
        }
        System.out.println(min);

        out.flush();
    } main {
        scanner = new Scanner(System.in);
        out = new PrintWriter(System.out);

        char[] line = nextLine().toCharArray();

        char[] second = nextLine().toCharArray();
        int in = line.length - second.length;

        int min = Integer.MAX_VALUE;

        int in2 = second.length;

        for (int i = 0; i <= in; i++) {
            int a = 0;
            for (int j = 0; j < in2; j++) {
                if (line[j+i] != second[j]) {
                    a++;
                }
            }
            if (min >= a) {
                min = a;
            }
        }
        System.out.println(min);

        out.flush();
    } scanner = new Scanner(System.in) scanner new Scanner(System.in) out = new PrintWriter(System.out) out new PrintWriter(System.out) char[] line = nextLine().toCharArray(); line nextLine().toCharArray() nextLine().toCharArray nextLine() nextLine char[] second = nextLine().toCharArray(); second nextLine().toCharArray() nextLine().toCharArray nextLine() nextLine int in = line.length - second.length; in line.length - second.length line.length line line.length second.length second second.length int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE int in2 = second.length; in2 second.length second second.length for (int i = 0; i <= in; i++) {
            int a = 0;
            for (int j = 0; j < in2; j++) {
                if (line[j+i] != second[j]) {
                    a++;
                }
            }
            if (min >= a) {
                min = a;
            }
        } int i = 0; int i = 0; i 0 i <= in i in i++ i++ i {
            int a = 0;
            for (int j = 0; j < in2; j++) {
                if (line[j+i] != second[j]) {
                    a++;
                }
            }
            if (min >= a) {
                min = a;
            }
        } {
            int a = 0;
            for (int j = 0; j < in2; j++) {
                if (line[j+i] != second[j]) {
                    a++;
                }
            }
            if (min >= a) {
                min = a;
            }
        } int a = 0; a 0 for (int j = 0; j < in2; j++) {
                if (line[j+i] != second[j]) {
                    a++;
                }
            } int j = 0; int j = 0; j 0 j < in2 j in2 j++ j++ j {
                if (line[j+i] != second[j]) {
                    a++;
                }
            } {
                if (line[j+i] != second[j]) {
                    a++;
                }
            } if (line[j+i] != second[j]) {
                    a++;
                } line[j+i] != second[j] line[j+i] line j+i j i second[j] second j {
                    a++;
                } a++ a if (min >= a) {
                min = a;
            } min >= a min a {
                min = a;
            } min = a min a System.out.println(min) System.out.println System.out System System.out min out.flush() out.flush out String[] args args public static void println(Object o) {
        out.println(o);
    } println {
        out.println(o);
    } out.println(o) out.println out o Object o o public static void print(Object o) {
        out.print(o);
    } print {
        out.print(o);
    } out.print(o) out.print out o Object o o public static void printf(String format, Object... o) {
        out.printf(format, o);
    } printf {
        out.printf(format, o);
    } out.printf(format, o) out.printf out format o String format format Object... o o public static String next() {
        return scanner.next();
    } next {
        return scanner.next();
    } return scanner.next(); scanner.next() scanner.next scanner public static int nextInt() {
        return Integer.parseInt(scanner.next());
    } nextInt {
        return Integer.parseInt(scanner.next());
    } return Integer.parseInt(scanner.next()); Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner public static long nextLong() {
        return Long.parseLong(scanner.next());
    } nextLong {
        return Long.parseLong(scanner.next());
    } return Long.parseLong(scanner.next()); Long.parseLong(scanner.next()) Long.parseLong Long scanner.next() scanner.next scanner public static double nextDouble() {
        return Double.parseDouble(scanner.next());
    } nextDouble {
        return Double.parseDouble(scanner.next());
    } return Double.parseDouble(scanner.next()); Double.parseDouble(scanner.next()) Double.parseDouble Double scanner.next() scanner.next scanner public static short nextShort() {
        return Short.parseShort(scanner.next());
    } nextShort {
        return Short.parseShort(scanner.next());
    } return Short.parseShort(scanner.next()); Short.parseShort(scanner.next()) Short.parseShort Short scanner.next() scanner.next scanner public static float nextFloat() {
        return Float.parseFloat(scanner.next());
    } nextFloat {
        return Float.parseFloat(scanner.next());
    } return Float.parseFloat(scanner.next()); Float.parseFloat(scanner.next()) Float.parseFloat Float scanner.next() scanner.next scanner public static void printYes() {
        System.out.println("Yes");
    } printYes {
        System.out.println("Yes");
    } System.out.println("Yes") System.out.println System.out System System.out "Yes" public static void printYES() {
        System.out.println("YES");
    } printYES {
        System.out.println("YES");
    } System.out.println("YES") System.out.println System.out System System.out "YES" public static void printNo() {
        System.out.println("No");
    } printNo {
        System.out.println("No");
    } System.out.println("No") System.out.println System.out System System.out "No" public static void printNO() {
        System.out.println("NO");
    } printNO {
        System.out.println("NO");
    } System.out.println("NO") System.out.println System.out System System.out "NO" public static String nextLine() {
        return scanner.nextLine();
    } nextLine {
        return scanner.nextLine();
    } return scanner.nextLine(); scanner.nextLine() scanner.nextLine scanner public static double distance(double x, double y, double x2, double y2) {
        return Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y));
    } distance {
        return Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y));
    } return Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y)); Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y)) Math.sqrt Math (x2 - x) * (x2 - x) + (y2 - y) * (y2 - y) (x2 - x) * (x2 - x) (x2 - x) x2 x (x2 - x) x2 x (y2 - y) * (y2 - y) (y2 - y) y2 y (y2 - y) y2 y double x x double y y double x2 x2 double y2 y2 public static void combinit() {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < MAX; i++) {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    } combinit {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < MAX; i++) {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    } fac[0] = fac[1] = 1 fac[0] fac 0 fac[1] = 1 fac[1] fac 1 1 finv[0] = finv[1] = 1 finv[0] finv 0 finv[1] = 1 finv[1] finv 1 1 inv[1] = 1 inv[1] inv 1 1 for (int i = 2; i < MAX; i++) {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        } int i = 2; int i = 2; i 2 i < MAX i MAX i++ i++ i {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        } {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        } fac[i] = fac[i - 1] * i % MOD fac[i] fac i fac[i - 1] * i % MOD fac[i - 1] * i fac[i - 1] fac i - 1 i 1 i MOD inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD inv[i] inv i MOD - inv[MOD % i] * (MOD / i) % MOD MOD inv[MOD % i] * (MOD / i) % MOD inv[MOD % i] * (MOD / i) inv[MOD % i] inv MOD % i MOD i (MOD / i) MOD i MOD finv[i] = finv[i - 1] * inv[i] % MOD finv[i] finv i finv[i - 1] * inv[i] % MOD finv[i - 1] * inv[i] finv[i - 1] finv i - 1 i 1 inv[i] inv i MOD public static long combination(int n, int k) {
        if (n < k || n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    } combination {
        if (n < k || n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    } if (n < k || n < 0 || k < 0) return 0; n < k || n < 0 || k < 0 n < k || n < 0 || k < 0 n < k n k n < 0 n 0 k < 0 k 0 return 0; 0 return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; fac[n] * (finv[k] * finv[n - k] % MOD) % MOD fac[n] * (finv[k] * finv[n - k] % MOD) fac[n] fac n (finv[k] * finv[n - k] % MOD) finv[k] * finv[n - k] finv[k] finv k finv[n - k] finv n - k n k MOD MOD int n n int k k public static long factorial(long n) {
        return n <= 0 ? 1 : n * factorial(n - 1);
    } factorial {
        return n <= 0 ? 1 : n * factorial(n - 1);
    } return n <= 0 ? 1 : n * factorial(n - 1); n <= 0 ? 1 : n * factorial(n - 1) n <= 0 n 0 1 n * factorial(n - 1) n factorial(n - 1) factorial n - 1 n 1 long n n public class Main {
    static Scanner scanner;
    static PrintWriter out;
    public static void main(String[] args) {
        scanner = new Scanner(System.in);
        out = new PrintWriter(System.out);

        char[] line = nextLine().toCharArray();

        char[] second = nextLine().toCharArray();
        int in = line.length - second.length;

        int min = Integer.MAX_VALUE;

        int in2 = second.length;

        for (int i = 0; i <= in; i++) {
            int a = 0;
            for (int j = 0; j < in2; j++) {
                if (line[j+i] != second[j]) {
                    a++;
                }
            }
            if (min >= a) {
                min = a;
            }
        }
        System.out.println(min);

        out.flush();
    }

    public static void println(Object o) {
        out.println(o);
    }

    public static void print(Object o) {
        out.print(o);
    }

    public static void printf(String format, Object... o) {
        out.printf(format, o);
    }

    public static String next() {
        return scanner.next();
    }

    public static int nextInt() {
        return Integer.parseInt(scanner.next());
    }

    public static long nextLong() {
        return Long.parseLong(scanner.next());
    }

    public static double nextDouble() {
        return Double.parseDouble(scanner.next());
    }

    public static short nextShort() {
        return Short.parseShort(scanner.next());
    }

    public static float nextFloat() {
        return Float.parseFloat(scanner.next());
    }

    public static void printYes() {
        System.out.println("Yes");
    }

    public static void printYES() {
        System.out.println("YES");
    }

    public static void printNo() {
        System.out.println("No");
    }

    public static void printNO() {
        System.out.println("NO");
    }

    public static String nextLine() {
        return scanner.nextLine();
    }

    public static double distance(double x, double y, double x2, double y2) {
        return Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y));
    }

    public static int MOD = 1_000_000_007;
    public static int MAX = 100000;
    public static long[] fac = new long[MAX];
    public static long[] finv = new long[MAX];
    public static long[] inv = new long[MAX];

    public static void combinit() {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < MAX; i++) {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }

    public static long combination(int n, int k) {
        if (n < k || n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }

    public static long factorial(long n) {
        return n <= 0 ? 1 : n * factorial(n - 1);
    }
} public class Main {
    static Scanner scanner;
    static PrintWriter out;
    public static void main(String[] args) {
        scanner = new Scanner(System.in);
        out = new PrintWriter(System.out);

        char[] line = nextLine().toCharArray();

        char[] second = nextLine().toCharArray();
        int in = line.length - second.length;

        int min = Integer.MAX_VALUE;

        int in2 = second.length;

        for (int i = 0; i <= in; i++) {
            int a = 0;
            for (int j = 0; j < in2; j++) {
                if (line[j+i] != second[j]) {
                    a++;
                }
            }
            if (min >= a) {
                min = a;
            }
        }
        System.out.println(min);

        out.flush();
    }

    public static void println(Object o) {
        out.println(o);
    }

    public static void print(Object o) {
        out.print(o);
    }

    public static void printf(String format, Object... o) {
        out.printf(format, o);
    }

    public static String next() {
        return scanner.next();
    }

    public static int nextInt() {
        return Integer.parseInt(scanner.next());
    }

    public static long nextLong() {
        return Long.parseLong(scanner.next());
    }

    public static double nextDouble() {
        return Double.parseDouble(scanner.next());
    }

    public static short nextShort() {
        return Short.parseShort(scanner.next());
    }

    public static float nextFloat() {
        return Float.parseFloat(scanner.next());
    }

    public static void printYes() {
        System.out.println("Yes");
    }

    public static void printYES() {
        System.out.println("YES");
    }

    public static void printNo() {
        System.out.println("No");
    }

    public static void printNO() {
        System.out.println("NO");
    }

    public static String nextLine() {
        return scanner.nextLine();
    }

    public static double distance(double x, double y, double x2, double y2) {
        return Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y));
    }

    public static int MOD = 1_000_000_007;
    public static int MAX = 100000;
    public static long[] fac = new long[MAX];
    public static long[] finv = new long[MAX];
    public static long[] inv = new long[MAX];

    public static void combinit() {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < MAX; i++) {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }

    public static long combination(int n, int k) {
        if (n < k || n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }

    public static long factorial(long n) {
        return n <= 0 ? 1 : n * factorial(n - 1);
    }
} Main

import java.io.PrintWriter;
import java.util.*;

public class Main {
    static Scanner scanner;
    static PrintWriter out;
    public static void main(String[] args) {
        scanner = new Scanner(System.in);
        out = new PrintWriter(System.out);

        char[] line = nextLine().toCharArray();

        char[] second = nextLine().toCharArray();
        int in = line.length - second.length;

        int min = Integer.MAX_VALUE;

        int in2 = second.length;

        for (int i = 0; i <= in; i++) {
            int a = 0;
            for (int j = 0; j < in2; j++) {
                if (line[j+i] != second[j]) {
                    a++;
                }
            }
            if (min >= a) {
                min = a;
            }
        }
        System.out.println(min);

        out.flush();
    }

    public static void println(Object o) {
        out.println(o);
    }

    public static void print(Object o) {
        out.print(o);
    }

    public static void printf(String format, Object... o) {
        out.printf(format, o);
    }

    public static String next() {
        return scanner.next();
    }

    public static int nextInt() {
        return Integer.parseInt(scanner.next());
    }

    public static long nextLong() {
        return Long.parseLong(scanner.next());
    }

    public static double nextDouble() {
        return Double.parseDouble(scanner.next());
    }

    public static short nextShort() {
        return Short.parseShort(scanner.next());
    }

    public static float nextFloat() {
        return Float.parseFloat(scanner.next());
    }

    public static void printYes() {
        System.out.println("Yes");
    }

    public static void printYES() {
        System.out.println("YES");
    }

    public static void printNo() {
        System.out.println("No");
    }

    public static void printNO() {
        System.out.println("NO");
    }

    public static String nextLine() {
        return scanner.nextLine();
    }

    public static double distance(double x, double y, double x2, double y2) {
        return Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y));
    }

    public static int MOD = 1_000_000_007;
    public static int MAX = 100000;
    public static long[] fac = new long[MAX];
    public static long[] finv = new long[MAX];
    public static long[] inv = new long[MAX];

    public static void combinit() {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < MAX; i++) {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }

    public static long combination(int n, int k) {
        if (n < k || n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }

    public static long factorial(long n) {
        return n <= 0 ? 1 : n * factorial(n - 1);
    }
}