import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter prnt = new PrintWriter(System.out);
        StringTokenizer st;
        String S = read.readLine();
        String T = read.readLine();
        prnt.println(getMinimumChange(S, T));


        prnt.close();
    }

    static int getMinimumChange(String S, String T) {
        int res = T.length();
        for (int i = 0; i < (S.length() - T.length() + 1); i++) {
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                // System.out.println(S.charAt(i+j) + " " + T.charAt(j));
                if (S.charAt(i + j) != T.charAt(j)) {
                    count++;
                }
            }
            res = Math.min(res, count);
        }
        return res;
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter prnt = new PrintWriter(System.out);
        StringTokenizer st;
        String S = read.readLine();
        String T = read.readLine();
        prnt.println(getMinimumChange(S, T));


        prnt.close();
    }

    static int getMinimumChange(String S, String T) {
        int res = T.length();
        for (int i = 0; i < (S.length() - T.length() + 1); i++) {
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                // System.out.println(S.charAt(i+j) + " " + T.charAt(j));
                if (S.charAt(i + j) != T.charAt(j)) {
                    count++;
                }
            }
            res = Math.min(res, count);
        }
        return res;
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter prnt = new PrintWriter(System.out);
        StringTokenizer st;
        String S = read.readLine();
        String T = read.readLine();
        prnt.println(getMinimumChange(S, T));


        prnt.close();
    } main {
        BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter prnt = new PrintWriter(System.out);
        StringTokenizer st;
        String S = read.readLine();
        String T = read.readLine();
        prnt.println(getMinimumChange(S, T));


        prnt.close();
    } BufferedReader read = new BufferedReader(new InputStreamReader(System.in)); read new BufferedReader(new InputStreamReader(System.in)) PrintWriter prnt = new PrintWriter(System.out); prnt new PrintWriter(System.out) StringTokenizer st; st String S = read.readLine(); S read.readLine() read.readLine read String T = read.readLine(); T read.readLine() read.readLine read prnt.println(getMinimumChange(S, T)) prnt.println prnt getMinimumChange(S, T) getMinimumChange S T prnt.close() prnt.close prnt String[] args args static int getMinimumChange(String S, String T) {
        int res = T.length();
        for (int i = 0; i < (S.length() - T.length() + 1); i++) {
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                // System.out.println(S.charAt(i+j) + " " + T.charAt(j));
                if (S.charAt(i + j) != T.charAt(j)) {
                    count++;
                }
            }
            res = Math.min(res, count);
        }
        return res;
    } getMinimumChange {
        int res = T.length();
        for (int i = 0; i < (S.length() - T.length() + 1); i++) {
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                // System.out.println(S.charAt(i+j) + " " + T.charAt(j));
                if (S.charAt(i + j) != T.charAt(j)) {
                    count++;
                }
            }
            res = Math.min(res, count);
        }
        return res;
    } int res = T.length(); res T.length() T.length T for (int i = 0; i < (S.length() - T.length() + 1); i++) {
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                // System.out.println(S.charAt(i+j) + " " + T.charAt(j));
                if (S.charAt(i + j) != T.charAt(j)) {
                    count++;
                }
            }
            res = Math.min(res, count);
        } 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 {
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                // System.out.println(S.charAt(i+j) + " " + T.charAt(j));
                if (S.charAt(i + j) != T.charAt(j)) {
                    count++;
                }
            }
            res = Math.min(res, count);
        } {
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                // System.out.println(S.charAt(i+j) + " " + T.charAt(j));
                if (S.charAt(i + j) != T.charAt(j)) {
                    count++;
                }
            }
            res = Math.min(res, count);
        } int count = 0; count 0 for (int j = 0; j < T.length(); j++) {
                // System.out.println(S.charAt(i+j) + " " + T.charAt(j));
                if (S.charAt(i + j) != T.charAt(j)) {
                    count++;
                }
            } int j = 0; int j = 0; j 0 j < T.length() j T.length() T.length T j++ j++ j {
                // System.out.println(S.charAt(i+j) + " " + T.charAt(j));
                if (S.charAt(i + j) != T.charAt(j)) {
                    count++;
                }
            } {
                // System.out.println(S.charAt(i+j) + " " + T.charAt(j));
                if (S.charAt(i + j) != T.charAt(j)) {
                    count++;
                }
            } if (S.charAt(i + j) != T.charAt(j)) {
                    count++;
                } 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 {
                    count++;
                } count++ count res = Math.min(res, count) res Math.min(res, count) Math.min Math res count return res; res String S S String T T public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter prnt = new PrintWriter(System.out);
        StringTokenizer st;
        String S = read.readLine();
        String T = read.readLine();
        prnt.println(getMinimumChange(S, T));


        prnt.close();
    }

    static int getMinimumChange(String S, String T) {
        int res = T.length();
        for (int i = 0; i < (S.length() - T.length() + 1); i++) {
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                // System.out.println(S.charAt(i+j) + " " + T.charAt(j));
                if (S.charAt(i + j) != T.charAt(j)) {
                    count++;
                }
            }
            res = Math.min(res, count);
        }
        return res;
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter prnt = new PrintWriter(System.out);
        StringTokenizer st;
        String S = read.readLine();
        String T = read.readLine();
        prnt.println(getMinimumChange(S, T));


        prnt.close();
    }

    static int getMinimumChange(String S, String T) {
        int res = T.length();
        for (int i = 0; i < (S.length() - T.length() + 1); i++) {
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                // System.out.println(S.charAt(i+j) + " " + T.charAt(j));
                if (S.charAt(i + j) != T.charAt(j)) {
                    count++;
                }
            }
            res = Math.min(res, count);
        }
        return res;
    }
} Main
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter prnt = new PrintWriter(System.out);
        StringTokenizer st;
        String S = read.readLine();
        String T = read.readLine();
        prnt.println(getMinimumChange(S, T));


        prnt.close();
    }

    static int getMinimumChange(String S, String T) {
        int res = T.length();
        for (int i = 0; i < (S.length() - T.length() + 1); i++) {
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                // System.out.println(S.charAt(i+j) + " " + T.charAt(j));
                if (S.charAt(i + j) != T.charAt(j)) {
                    count++;
                }
            }
            res = Math.min(res, count);
        }
        return res;
    }
}