import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();
        System.out.println(minimumChar(t, s));
    }

    static int minimumChar(String S1, String S2) {
        int n = S1.length();
        int m = S2.length();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < m - n + 1; i++) {
            int minRemovedChar = 0;
            for (int j = 0; j < n; j++) {
                if (S1.charAt(j) != S2.charAt(i + j)) {
                    minRemovedChar++;
                }
            }
            ans = Math.min(minRemovedChar, ans);
        }
        return ans;
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();
        System.out.println(minimumChar(t, s));
    }

    static int minimumChar(String S1, String S2) {
        int n = S1.length();
        int m = S2.length();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < m - n + 1; i++) {
            int minRemovedChar = 0;
            for (int j = 0; j < n; j++) {
                if (S1.charAt(j) != S2.charAt(i + j)) {
                    minRemovedChar++;
                }
            }
            ans = Math.min(minRemovedChar, ans);
        }
        return ans;
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();
        System.out.println(minimumChar(t, s));
    } main {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();
        System.out.println(minimumChar(t, s));
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) String s = in.next(); s in.next() in.next in String t = in.next(); t in.next() in.next in System.out.println(minimumChar(t, s)) System.out.println System.out System System.out minimumChar(t, s) minimumChar t s String[] args args static int minimumChar(String S1, String S2) {
        int n = S1.length();
        int m = S2.length();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < m - n + 1; i++) {
            int minRemovedChar = 0;
            for (int j = 0; j < n; j++) {
                if (S1.charAt(j) != S2.charAt(i + j)) {
                    minRemovedChar++;
                }
            }
            ans = Math.min(minRemovedChar, ans);
        }
        return ans;
    } minimumChar {
        int n = S1.length();
        int m = S2.length();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < m - n + 1; i++) {
            int minRemovedChar = 0;
            for (int j = 0; j < n; j++) {
                if (S1.charAt(j) != S2.charAt(i + j)) {
                    minRemovedChar++;
                }
            }
            ans = Math.min(minRemovedChar, ans);
        }
        return ans;
    } int n = S1.length(); n S1.length() S1.length S1 int m = S2.length(); m S2.length() S2.length S2 int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = 0; i < m - n + 1; i++) {
            int minRemovedChar = 0;
            for (int j = 0; j < n; j++) {
                if (S1.charAt(j) != S2.charAt(i + j)) {
                    minRemovedChar++;
                }
            }
            ans = Math.min(minRemovedChar, ans);
        } int i = 0; int i = 0; i 0 i < m - n + 1 i m - n + 1 m - n m n 1 i++ i++ i {
            int minRemovedChar = 0;
            for (int j = 0; j < n; j++) {
                if (S1.charAt(j) != S2.charAt(i + j)) {
                    minRemovedChar++;
                }
            }
            ans = Math.min(minRemovedChar, ans);
        } {
            int minRemovedChar = 0;
            for (int j = 0; j < n; j++) {
                if (S1.charAt(j) != S2.charAt(i + j)) {
                    minRemovedChar++;
                }
            }
            ans = Math.min(minRemovedChar, ans);
        } int minRemovedChar = 0; minRemovedChar 0 for (int j = 0; j < n; j++) {
                if (S1.charAt(j) != S2.charAt(i + j)) {
                    minRemovedChar++;
                }
            } int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
                if (S1.charAt(j) != S2.charAt(i + j)) {
                    minRemovedChar++;
                }
            } {
                if (S1.charAt(j) != S2.charAt(i + j)) {
                    minRemovedChar++;
                }
            } if (S1.charAt(j) != S2.charAt(i + j)) {
                    minRemovedChar++;
                } S1.charAt(j) != S2.charAt(i + j) S1.charAt(j) S1.charAt S1 j S2.charAt(i + j) S2.charAt S2 i + j i j {
                    minRemovedChar++;
                } minRemovedChar++ minRemovedChar ans = Math.min(minRemovedChar, ans) ans Math.min(minRemovedChar, ans) Math.min Math minRemovedChar ans return ans; ans String S1 S1 String S2 S2 public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();
        System.out.println(minimumChar(t, s));
    }

    static int minimumChar(String S1, String S2) {
        int n = S1.length();
        int m = S2.length();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < m - n + 1; i++) {
            int minRemovedChar = 0;
            for (int j = 0; j < n; j++) {
                if (S1.charAt(j) != S2.charAt(i + j)) {
                    minRemovedChar++;
                }
            }
            ans = Math.min(minRemovedChar, ans);
        }
        return ans;
    }
} public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();
        System.out.println(minimumChar(t, s));
    }

    static int minimumChar(String S1, String S2) {
        int n = S1.length();
        int m = S2.length();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < m - n + 1; i++) {
            int minRemovedChar = 0;
            for (int j = 0; j < n; j++) {
                if (S1.charAt(j) != S2.charAt(i + j)) {
                    minRemovedChar++;
                }
            }
            ans = Math.min(minRemovedChar, ans);
        }
        return ans;
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();
        System.out.println(minimumChar(t, s));
    }

    static int minimumChar(String S1, String S2) {
        int n = S1.length();
        int m = S2.length();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < m - n + 1; i++) {
            int minRemovedChar = 0;
            for (int j = 0; j < n; j++) {
                if (S1.charAt(j) != S2.charAt(i + j)) {
                    minRemovedChar++;
                }
            }
            ans = Math.min(minRemovedChar, ans);
        }
        return ans;
    }
}
