import java.util.Scanner;

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

        String S = scanner.next();
        String T = scanner.next();

        // 素直にやっても最悪1000 * 1000なので行ける気がする
        int minReplace = Integer.MAX_VALUE;

        for (int seek = 0; seek + T.length() <= S.length(); seek++) {
            int replace = 0;
            for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i) != S.charAt(seek + i)) {
                    replace++;
                }
            }

            if (minReplace > replace) {
                minReplace = replace;
            }
        }

        System.out.println(minReplace);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String... args) {
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();
        String T = scanner.next();

        // 素直にやっても最悪1000 * 1000なので行ける気がする
        int minReplace = Integer.MAX_VALUE;

        for (int seek = 0; seek + T.length() <= S.length(); seek++) {
            int replace = 0;
            for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i) != S.charAt(seek + i)) {
                    replace++;
                }
            }

            if (minReplace > replace) {
                minReplace = replace;
            }
        }

        System.out.println(minReplace);
    }
} Main public static void main(String... args) {
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();
        String T = scanner.next();

        // 素直にやっても最悪1000 * 1000なので行ける気がする
        int minReplace = Integer.MAX_VALUE;

        for (int seek = 0; seek + T.length() <= S.length(); seek++) {
            int replace = 0;
            for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i) != S.charAt(seek + i)) {
                    replace++;
                }
            }

            if (minReplace > replace) {
                minReplace = replace;
            }
        }

        System.out.println(minReplace);
    } main {
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();
        String T = scanner.next();

        // 素直にやっても最悪1000 * 1000なので行ける気がする
        int minReplace = Integer.MAX_VALUE;

        for (int seek = 0; seek + T.length() <= S.length(); seek++) {
            int replace = 0;
            for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i) != S.charAt(seek + i)) {
                    replace++;
                }
            }

            if (minReplace > replace) {
                minReplace = replace;
            }
        }

        System.out.println(minReplace);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String S = scanner.next(); S scanner.next() scanner.next scanner String T = scanner.next(); T scanner.next() scanner.next scanner int minReplace = Integer.MAX_VALUE; minReplace Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int seek = 0; seek + T.length() <= S.length(); seek++) {
            int replace = 0;
            for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i) != S.charAt(seek + i)) {
                    replace++;
                }
            }

            if (minReplace > replace) {
                minReplace = replace;
            }
        } int seek = 0; int seek = 0; seek 0 seek + T.length() <= S.length() seek + T.length() seek T.length() T.length T S.length() S.length S seek++ seek++ seek {
            int replace = 0;
            for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i) != S.charAt(seek + i)) {
                    replace++;
                }
            }

            if (minReplace > replace) {
                minReplace = replace;
            }
        } {
            int replace = 0;
            for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i) != S.charAt(seek + i)) {
                    replace++;
                }
            }

            if (minReplace > replace) {
                minReplace = replace;
            }
        } int replace = 0; replace 0 for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i) != S.charAt(seek + i)) {
                    replace++;
                }
            } int i = 0; int i = 0; i 0 i < T.length() i T.length() T.length T i++ i++ i {
                if (T.charAt(i) != S.charAt(seek + i)) {
                    replace++;
                }
            } {
                if (T.charAt(i) != S.charAt(seek + i)) {
                    replace++;
                }
            } if (T.charAt(i) != S.charAt(seek + i)) {
                    replace++;
                } T.charAt(i) != S.charAt(seek + i) T.charAt(i) T.charAt T i S.charAt(seek + i) S.charAt S seek + i seek i {
                    replace++;
                } replace++ replace if (minReplace > replace) {
                minReplace = replace;
            } minReplace > replace minReplace replace {
                minReplace = replace;
            } minReplace = replace minReplace replace System.out.println(minReplace) System.out.println System.out System System.out minReplace String... args args public class Main {
    public static void main(String... args) {
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();
        String T = scanner.next();

        // 素直にやっても最悪1000 * 1000なので行ける気がする
        int minReplace = Integer.MAX_VALUE;

        for (int seek = 0; seek + T.length() <= S.length(); seek++) {
            int replace = 0;
            for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i) != S.charAt(seek + i)) {
                    replace++;
                }
            }

            if (minReplace > replace) {
                minReplace = replace;
            }
        }

        System.out.println(minReplace);
    }
} public class Main {
    public static void main(String... args) {
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();
        String T = scanner.next();

        // 素直にやっても最悪1000 * 1000なので行ける気がする
        int minReplace = Integer.MAX_VALUE;

        for (int seek = 0; seek + T.length() <= S.length(); seek++) {
            int replace = 0;
            for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i) != S.charAt(seek + i)) {
                    replace++;
                }
            }

            if (minReplace > replace) {
                minReplace = replace;
            }
        }

        System.out.println(minReplace);
    }
} Main
import java.util.Scanner;

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

        String S = scanner.next();
        String T = scanner.next();

        // 素直にやっても最悪1000 * 1000なので行ける気がする
        int minReplace = Integer.MAX_VALUE;

        for (int seek = 0; seek + T.length() <= S.length(); seek++) {
            int replace = 0;
            for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i) != S.charAt(seek + i)) {
                    replace++;
                }
            }

            if (minReplace > replace) {
                minReplace = replace;
            }
        }

        System.out.println(minReplace);
    }
}