import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        String t = scanner.nextLine();
        int ns = s.length(), nt = t.length();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i + nt <= ns; i++) {
            int diff = 0;
            for (int j = 0; j < nt; j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    diff++;
                }
            }
            ans = Math.min(diff, ans);
        }
        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.nextLine();
        String t = scanner.nextLine();
        int ns = s.length(), nt = t.length();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i + nt <= ns; i++) {
            int diff = 0;
            for (int j = 0; j < nt; j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    diff++;
                }
            }
            ans = Math.min(diff, ans);
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        String t = scanner.nextLine();
        int ns = s.length(), nt = t.length();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i + nt <= ns; i++) {
            int diff = 0;
            for (int j = 0; j < nt; j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    diff++;
                }
            }
            ans = Math.min(diff, ans);
        }
        System.out.println(ans);
    } main {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        String t = scanner.nextLine();
        int ns = s.length(), nt = t.length();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i + nt <= ns; i++) {
            int diff = 0;
            for (int j = 0; j < nt; j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    diff++;
                }
            }
            ans = Math.min(diff, ans);
        }
        System.out.println(ans);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String s = scanner.nextLine(); s scanner.nextLine() scanner.nextLine scanner String t = scanner.nextLine(); t scanner.nextLine() scanner.nextLine scanner int ns = s.length() ns s.length() s.length s nt = t.length(); nt t.length() t.length t int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = 0; i + nt <= ns; i++) {
            int diff = 0;
            for (int j = 0; j < nt; j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    diff++;
                }
            }
            ans = Math.min(diff, ans);
        } int i = 0; int i = 0; i 0 i + nt <= ns i + nt i nt ns i++ i++ i {
            int diff = 0;
            for (int j = 0; j < nt; j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    diff++;
                }
            }
            ans = Math.min(diff, ans);
        } {
            int diff = 0;
            for (int j = 0; j < nt; j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    diff++;
                }
            }
            ans = Math.min(diff, ans);
        } int diff = 0; diff 0 for (int j = 0; j < nt; j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    diff++;
                }
            } int j = 0; int j = 0; j 0 j < nt j nt j++ j++ j {
                if (s.charAt(i + j) != t.charAt(j)) {
                    diff++;
                }
            } {
                if (s.charAt(i + j) != t.charAt(j)) {
                    diff++;
                }
            } if (s.charAt(i + j) != t.charAt(j)) {
                    diff++;
                } 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 {
                    diff++;
                } diff++ diff ans = Math.min(diff, ans) ans Math.min(diff, ans) Math.min Math diff ans 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.nextLine();
        String t = scanner.nextLine();
        int ns = s.length(), nt = t.length();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i + nt <= ns; i++) {
            int diff = 0;
            for (int j = 0; j < nt; j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    diff++;
                }
            }
            ans = Math.min(diff, ans);
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        String t = scanner.nextLine();
        int ns = s.length(), nt = t.length();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i + nt <= ns; i++) {
            int diff = 0;
            for (int j = 0; j < nt; j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    diff++;
                }
            }
            ans = Math.min(diff, ans);
        }
        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.nextLine();
        String t = scanner.nextLine();
        int ns = s.length(), nt = t.length();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i + nt <= ns; i++) {
            int diff = 0;
            for (int j = 0; j < nt; j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    diff++;
                }
            }
            ans = Math.min(diff, ans);
        }
        System.out.println(ans);
    }
}