import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;

public class Main {
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);

        String S = br.readLine();
        String T = br.readLine();

        String[] T_array = T.split("");

        int ans = T.length();

        for(int i = 0; i < S.length() - T.length() + 1; i++) {
            String str = S.substring(i, i + T.length());
            String[] str_array = str.split("");

            int tmp = 0;

            for(int j = 0; j < str_array.length; j++) {
                if(!str_array[j].equals(T_array[j])) {
                    tmp += 1;
                }
            }

            if(ans > tmp) ans = tmp;
        }

        pw.println(ans);
        br.close();
        pw.close();
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.PrintWriter; PrintWriter java.io public class Main {
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);

        String S = br.readLine();
        String T = br.readLine();

        String[] T_array = T.split("");

        int ans = T.length();

        for(int i = 0; i < S.length() - T.length() + 1; i++) {
            String str = S.substring(i, i + T.length());
            String[] str_array = str.split("");

            int tmp = 0;

            for(int j = 0; j < str_array.length; j++) {
                if(!str_array[j].equals(T_array[j])) {
                    tmp += 1;
                }
            }

            if(ans > tmp) ans = tmp;
        }

        pw.println(ans);
        br.close();
        pw.close();
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);

        String S = br.readLine();
        String T = br.readLine();

        String[] T_array = T.split("");

        int ans = T.length();

        for(int i = 0; i < S.length() - T.length() + 1; i++) {
            String str = S.substring(i, i + T.length());
            String[] str_array = str.split("");

            int tmp = 0;

            for(int j = 0; j < str_array.length; j++) {
                if(!str_array[j].equals(T_array[j])) {
                    tmp += 1;
                }
            }

            if(ans > tmp) ans = tmp;
        }

        pw.println(ans);
        br.close();
        pw.close();
    } main {
        BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);

        String S = br.readLine();
        String T = br.readLine();

        String[] T_array = T.split("");

        int ans = T.length();

        for(int i = 0; i < S.length() - T.length() + 1; i++) {
            String str = S.substring(i, i + T.length());
            String[] str_array = str.split("");

            int tmp = 0;

            for(int j = 0; j < str_array.length; j++) {
                if(!str_array[j].equals(T_array[j])) {
                    tmp += 1;
                }
            }

            if(ans > tmp) ans = tmp;
        }

        pw.println(ans);
        br.close();
        pw.close();
    } BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in)); br new BufferedReader(new java.io.InputStreamReader(System.in)) PrintWriter pw = new PrintWriter(System.out); pw new PrintWriter(System.out) String S = br.readLine(); S br.readLine() br.readLine br String T = br.readLine(); T br.readLine() br.readLine br String[] T_array = T.split(""); T_array T.split("") T.split T "" int ans = T.length(); ans T.length() T.length T for(int i = 0; i < S.length() - T.length() + 1; i++) {
            String str = S.substring(i, i + T.length());
            String[] str_array = str.split("");

            int tmp = 0;

            for(int j = 0; j < str_array.length; j++) {
                if(!str_array[j].equals(T_array[j])) {
                    tmp += 1;
                }
            }

            if(ans > tmp) ans = tmp;
        } int i = 0; int i = 0; i 0 i < S.length() - T.length() + 1 i S.length() - T.length() + 1 S.length() - T.length() S.length() S.length S T.length() T.length T 1 i++ i++ i {
            String str = S.substring(i, i + T.length());
            String[] str_array = str.split("");

            int tmp = 0;

            for(int j = 0; j < str_array.length; j++) {
                if(!str_array[j].equals(T_array[j])) {
                    tmp += 1;
                }
            }

            if(ans > tmp) ans = tmp;
        } {
            String str = S.substring(i, i + T.length());
            String[] str_array = str.split("");

            int tmp = 0;

            for(int j = 0; j < str_array.length; j++) {
                if(!str_array[j].equals(T_array[j])) {
                    tmp += 1;
                }
            }

            if(ans > tmp) ans = tmp;
        } String str = S.substring(i, i + T.length()); str S.substring(i, i + T.length()) S.substring S i i + T.length() i T.length() T.length T String[] str_array = str.split(""); str_array str.split("") str.split str "" int tmp = 0; tmp 0 for(int j = 0; j < str_array.length; j++) {
                if(!str_array[j].equals(T_array[j])) {
                    tmp += 1;
                }
            } int j = 0; int j = 0; j 0 j < str_array.length j str_array.length str_array str_array.length j++ j++ j {
                if(!str_array[j].equals(T_array[j])) {
                    tmp += 1;
                }
            } {
                if(!str_array[j].equals(T_array[j])) {
                    tmp += 1;
                }
            } if(!str_array[j].equals(T_array[j])) {
                    tmp += 1;
                } !str_array[j].equals(T_array[j]) str_array[j].equals(T_array[j]) str_array[j].equals str_array[j] str_array j T_array[j] T_array j {
                    tmp += 1;
                } tmp += 1 tmp 1 if(ans > tmp) ans = tmp; ans > tmp ans tmp ans = tmp ans tmp pw.println(ans) pw.println pw ans br.close() br.close br pw.close() pw.close pw String[] args args public class Main {
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);

        String S = br.readLine();
        String T = br.readLine();

        String[] T_array = T.split("");

        int ans = T.length();

        for(int i = 0; i < S.length() - T.length() + 1; i++) {
            String str = S.substring(i, i + T.length());
            String[] str_array = str.split("");

            int tmp = 0;

            for(int j = 0; j < str_array.length; j++) {
                if(!str_array[j].equals(T_array[j])) {
                    tmp += 1;
                }
            }

            if(ans > tmp) ans = tmp;
        }

        pw.println(ans);
        br.close();
        pw.close();
    }
} public class Main {
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);

        String S = br.readLine();
        String T = br.readLine();

        String[] T_array = T.split("");

        int ans = T.length();

        for(int i = 0; i < S.length() - T.length() + 1; i++) {
            String str = S.substring(i, i + T.length());
            String[] str_array = str.split("");

            int tmp = 0;

            for(int j = 0; j < str_array.length; j++) {
                if(!str_array[j].equals(T_array[j])) {
                    tmp += 1;
                }
            }

            if(ans > tmp) ans = tmp;
        }

        pw.println(ans);
        br.close();
        pw.close();
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;

public class Main {
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);

        String S = br.readLine();
        String T = br.readLine();

        String[] T_array = T.split("");

        int ans = T.length();

        for(int i = 0; i < S.length() - T.length() + 1; i++) {
            String str = S.substring(i, i + T.length());
            String[] str_array = str.split("");

            int tmp = 0;

            for(int j = 0; j < str_array.length; j++) {
                if(!str_array[j].equals(T_array[j])) {
                    tmp += 1;
                }
            }

            if(ans > tmp) ans = tmp;
        }

        pw.println(ans);
        br.close();
        pw.close();
    }
}