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();

        scanner.close();

        int ans = Integer.MAX_VALUE;
        if (S.contains(T)) {
            System.out.println(0);
            return;
        }

        int i = 0;
        while (true) {
            int temp = 0;
            for (int j = 0; j < T.length(); j++) {
                if (S.charAt(i + j) != T.charAt(j)) {
                    temp++;
                }
            }
            if (temp < ans) {
                ans = temp;
            }

            if (i >= S.length() - T.length()) {
                break;
            } else {
                i++;
            }
        }

        System.out.println(ans);
    }

} 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();

        scanner.close();

        int ans = Integer.MAX_VALUE;
        if (S.contains(T)) {
            System.out.println(0);
            return;
        }

        int i = 0;
        while (true) {
            int temp = 0;
            for (int j = 0; j < T.length(); j++) {
                if (S.charAt(i + j) != T.charAt(j)) {
                    temp++;
                }
            }
            if (temp < ans) {
                ans = temp;
            }

            if (i >= S.length() - T.length()) {
                break;
            } else {
                i++;
            }
        }

        System.out.println(ans);
    }

} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();

        scanner.close();

        int ans = Integer.MAX_VALUE;
        if (S.contains(T)) {
            System.out.println(0);
            return;
        }

        int i = 0;
        while (true) {
            int temp = 0;
            for (int j = 0; j < T.length(); j++) {
                if (S.charAt(i + j) != T.charAt(j)) {
                    temp++;
                }
            }
            if (temp < ans) {
                ans = temp;
            }

            if (i >= S.length() - T.length()) {
                break;
            } else {
                i++;
            }
        }

        System.out.println(ans);
    } main {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();

        scanner.close();

        int ans = Integer.MAX_VALUE;
        if (S.contains(T)) {
            System.out.println(0);
            return;
        }

        int i = 0;
        while (true) {
            int temp = 0;
            for (int j = 0; j < T.length(); j++) {
                if (S.charAt(i + j) != T.charAt(j)) {
                    temp++;
                }
            }
            if (temp < ans) {
                ans = temp;
            }

            if (i >= S.length() - T.length()) {
                break;
            } else {
                i++;
            }
        }

        System.out.println(ans);
    } 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 scanner.close() scanner.close scanner int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE if (S.contains(T)) {
            System.out.println(0);
            return;
        } S.contains(T) S.contains S T {
            System.out.println(0);
            return;
        } System.out.println(0) System.out.println System.out System System.out 0 return; int i = 0; i 0 while (true) {
            int temp = 0;
            for (int j = 0; j < T.length(); j++) {
                if (S.charAt(i + j) != T.charAt(j)) {
                    temp++;
                }
            }
            if (temp < ans) {
                ans = temp;
            }

            if (i >= S.length() - T.length()) {
                break;
            } else {
                i++;
            }
        } true {
            int temp = 0;
            for (int j = 0; j < T.length(); j++) {
                if (S.charAt(i + j) != T.charAt(j)) {
                    temp++;
                }
            }
            if (temp < ans) {
                ans = temp;
            }

            if (i >= S.length() - T.length()) {
                break;
            } else {
                i++;
            }
        } int temp = 0; temp 0 for (int j = 0; j < T.length(); j++) {
                if (S.charAt(i + j) != T.charAt(j)) {
                    temp++;
                }
            } 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)) {
                    temp++;
                }
            } {
                if (S.charAt(i + j) != T.charAt(j)) {
                    temp++;
                }
            } if (S.charAt(i + j) != T.charAt(j)) {
                    temp++;
                } 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 {
                    temp++;
                } temp++ temp if (temp < ans) {
                ans = temp;
            } temp < ans temp ans {
                ans = temp;
            } ans = temp ans temp if (i >= S.length() - T.length()) {
                break;
            } else {
                i++;
            } i >= S.length() - T.length() i S.length() - T.length() S.length() S.length S T.length() T.length T {
                break;
            } break; {
                i++;
            } i++ i 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 scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();

        scanner.close();

        int ans = Integer.MAX_VALUE;
        if (S.contains(T)) {
            System.out.println(0);
            return;
        }

        int i = 0;
        while (true) {
            int temp = 0;
            for (int j = 0; j < T.length(); j++) {
                if (S.charAt(i + j) != T.charAt(j)) {
                    temp++;
                }
            }
            if (temp < ans) {
                ans = temp;
            }

            if (i >= S.length() - T.length()) {
                break;
            } else {
                i++;
            }
        }

        System.out.println(ans);
    }

} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();

        scanner.close();

        int ans = Integer.MAX_VALUE;
        if (S.contains(T)) {
            System.out.println(0);
            return;
        }

        int i = 0;
        while (true) {
            int temp = 0;
            for (int j = 0; j < T.length(); j++) {
                if (S.charAt(i + j) != T.charAt(j)) {
                    temp++;
                }
            }
            if (temp < ans) {
                ans = temp;
            }

            if (i >= S.length() - T.length()) {
                break;
            } else {
                i++;
            }
        }

        System.out.println(ans);
    }

} 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();

        scanner.close();

        int ans = Integer.MAX_VALUE;
        if (S.contains(T)) {
            System.out.println(0);
            return;
        }

        int i = 0;
        while (true) {
            int temp = 0;
            for (int j = 0; j < T.length(); j++) {
                if (S.charAt(i + j) != T.charAt(j)) {
                    temp++;
                }
            }
            if (temp < ans) {
                ans = temp;
            }

            if (i >= S.length() - T.length()) {
                break;
            } else {
                i++;
            }
        }

        System.out.println(ans);
    }

}
