import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        CP sc = new CP();
        String S = sc.nextLine(), T = sc.nextLine();
        int max = Integer.MIN_VALUE;
        String p = "";
        for (int i = 0; i < S.length() - T.length() + 1; i++) {
            String j = S.substring(i, i + T.length());
            if (max < charMatch(T, j)) {
                max = charMatch(T, j);
                p = j;
            }
        }
        System.out.println(T.length() - charMatch(T, p));
    }

    static int charMatch(String A, String B) {
        int c = 0;
        for (int i = 0; i < A.length(); i++) {
            if (A.charAt(i) == B.charAt(i))
                c++;
        }
        return c;
    }

    /*****************************************************************************/
    static class CP {
        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;

        public CP() {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        }

        int nextInt() {
            return Integer.parseInt(NNNN());
        }

        long nextLong() {
            return Long.parseLong(NNNN());
        }

        double nextDouble() {
            return Double.parseDouble(NNNN());
        }

        String NNNN() {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

        String nextLine() {
            String spl = "";
            try {
                spl = bufferedReader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return spl;
        }
    }
    /*****************************************************************************/
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {
    public static void main(String[] args) {
        CP sc = new CP();
        String S = sc.nextLine(), T = sc.nextLine();
        int max = Integer.MIN_VALUE;
        String p = "";
        for (int i = 0; i < S.length() - T.length() + 1; i++) {
            String j = S.substring(i, i + T.length());
            if (max < charMatch(T, j)) {
                max = charMatch(T, j);
                p = j;
            }
        }
        System.out.println(T.length() - charMatch(T, p));
    }

    static int charMatch(String A, String B) {
        int c = 0;
        for (int i = 0; i < A.length(); i++) {
            if (A.charAt(i) == B.charAt(i))
                c++;
        }
        return c;
    }

    /*****************************************************************************/
    static class CP {
        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;

        public CP() {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        }

        int nextInt() {
            return Integer.parseInt(NNNN());
        }

        long nextLong() {
            return Long.parseLong(NNNN());
        }

        double nextDouble() {
            return Double.parseDouble(NNNN());
        }

        String NNNN() {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

        String nextLine() {
            String spl = "";
            try {
                spl = bufferedReader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return spl;
        }
    }
    /*****************************************************************************/
} Main public static void main(String[] args) {
        CP sc = new CP();
        String S = sc.nextLine(), T = sc.nextLine();
        int max = Integer.MIN_VALUE;
        String p = "";
        for (int i = 0; i < S.length() - T.length() + 1; i++) {
            String j = S.substring(i, i + T.length());
            if (max < charMatch(T, j)) {
                max = charMatch(T, j);
                p = j;
            }
        }
        System.out.println(T.length() - charMatch(T, p));
    } main {
        CP sc = new CP();
        String S = sc.nextLine(), T = sc.nextLine();
        int max = Integer.MIN_VALUE;
        String p = "";
        for (int i = 0; i < S.length() - T.length() + 1; i++) {
            String j = S.substring(i, i + T.length());
            if (max < charMatch(T, j)) {
                max = charMatch(T, j);
                p = j;
            }
        }
        System.out.println(T.length() - charMatch(T, p));
    } CP sc = new CP(); sc new CP() String S = sc.nextLine() S sc.nextLine() sc.nextLine sc T = sc.nextLine(); T sc.nextLine() sc.nextLine sc int max = Integer.MIN_VALUE; max Integer.MIN_VALUE Integer Integer.MIN_VALUE String p = ""; p "" for (int i = 0; i < S.length() - T.length() + 1; i++) {
            String j = S.substring(i, i + T.length());
            if (max < charMatch(T, j)) {
                max = charMatch(T, j);
                p = j;
            }
        } 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 j = S.substring(i, i + T.length());
            if (max < charMatch(T, j)) {
                max = charMatch(T, j);
                p = j;
            }
        } {
            String j = S.substring(i, i + T.length());
            if (max < charMatch(T, j)) {
                max = charMatch(T, j);
                p = j;
            }
        } String j = S.substring(i, i + T.length()); j S.substring(i, i + T.length()) S.substring S i i + T.length() i T.length() T.length T if (max < charMatch(T, j)) {
                max = charMatch(T, j);
                p = j;
            } max < charMatch(T, j) max charMatch(T, j) charMatch T j {
                max = charMatch(T, j);
                p = j;
            } max = charMatch(T, j) max charMatch(T, j) charMatch T j p = j p j System.out.println(T.length() - charMatch(T, p)) System.out.println System.out System System.out T.length() - charMatch(T, p) T.length() T.length T charMatch(T, p) charMatch T p String[] args args static int charMatch(String A, String B) {
        int c = 0;
        for (int i = 0; i < A.length(); i++) {
            if (A.charAt(i) == B.charAt(i))
                c++;
        }
        return c;
    } charMatch {
        int c = 0;
        for (int i = 0; i < A.length(); i++) {
            if (A.charAt(i) == B.charAt(i))
                c++;
        }
        return c;
    } int c = 0; c 0 for (int i = 0; i < A.length(); i++) {
            if (A.charAt(i) == B.charAt(i))
                c++;
        } int i = 0; int i = 0; i 0 i < A.length() i A.length() A.length A i++ i++ i {
            if (A.charAt(i) == B.charAt(i))
                c++;
        } {
            if (A.charAt(i) == B.charAt(i))
                c++;
        } if (A.charAt(i) == B.charAt(i))
                c++; A.charAt(i) == B.charAt(i) A.charAt(i) A.charAt A i B.charAt(i) B.charAt B i c++ c return c; c String A A String B B static class CP {
        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;

        public CP() {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        }

        int nextInt() {
            return Integer.parseInt(NNNN());
        }

        long nextLong() {
            return Long.parseLong(NNNN());
        }

        double nextDouble() {
            return Double.parseDouble(NNNN());
        }

        String NNNN() {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

        String nextLine() {
            String spl = "";
            try {
                spl = bufferedReader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return spl;
        }
    } CP BufferedReader bufferedReader; bufferedReader StringTokenizer stringTokenizer; stringTokenizer public CP() {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        } CP {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        } bufferedReader = new BufferedReader(new InputStreamReader(System.in)) bufferedReader new BufferedReader(new InputStreamReader(System.in)) int nextInt() {
            return Integer.parseInt(NNNN());
        } nextInt {
            return Integer.parseInt(NNNN());
        } return Integer.parseInt(NNNN()); Integer.parseInt(NNNN()) Integer.parseInt Integer NNNN() NNNN long nextLong() {
            return Long.parseLong(NNNN());
        } nextLong {
            return Long.parseLong(NNNN());
        } return Long.parseLong(NNNN()); Long.parseLong(NNNN()) Long.parseLong Long NNNN() NNNN double nextDouble() {
            return Double.parseDouble(NNNN());
        } nextDouble {
            return Double.parseDouble(NNNN());
        } return Double.parseDouble(NNNN()); Double.parseDouble(NNNN()) Double.parseDouble Double NNNN() NNNN String NNNN() {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        } NNNN {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        } while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } stringTokenizer == null || !stringTokenizer.hasMoreElements() stringTokenizer == null stringTokenizer null !stringTokenizer.hasMoreElements() stringTokenizer.hasMoreElements() stringTokenizer.hasMoreElements stringTokenizer {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                } IOException e {
                    e.printStackTrace();
                } e.printStackTrace() e.printStackTrace e {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } stringTokenizer = new StringTokenizer(bufferedReader.readLine()) stringTokenizer new StringTokenizer(bufferedReader.readLine()) return stringTokenizer.nextToken(); stringTokenizer.nextToken() stringTokenizer.nextToken stringTokenizer String nextLine() {
            String spl = "";
            try {
                spl = bufferedReader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return spl;
        } nextLine {
            String spl = "";
            try {
                spl = bufferedReader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return spl;
        } String spl = ""; spl "" try {
                spl = bufferedReader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } IOException e {
                e.printStackTrace();
            } e.printStackTrace() e.printStackTrace e {
                spl = bufferedReader.readLine();
            } spl = bufferedReader.readLine() spl bufferedReader.readLine() bufferedReader.readLine bufferedReader return spl; spl public class Main {
    public static void main(String[] args) {
        CP sc = new CP();
        String S = sc.nextLine(), T = sc.nextLine();
        int max = Integer.MIN_VALUE;
        String p = "";
        for (int i = 0; i < S.length() - T.length() + 1; i++) {
            String j = S.substring(i, i + T.length());
            if (max < charMatch(T, j)) {
                max = charMatch(T, j);
                p = j;
            }
        }
        System.out.println(T.length() - charMatch(T, p));
    }

    static int charMatch(String A, String B) {
        int c = 0;
        for (int i = 0; i < A.length(); i++) {
            if (A.charAt(i) == B.charAt(i))
                c++;
        }
        return c;
    }

    /*****************************************************************************/
    static class CP {
        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;

        public CP() {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        }

        int nextInt() {
            return Integer.parseInt(NNNN());
        }

        long nextLong() {
            return Long.parseLong(NNNN());
        }

        double nextDouble() {
            return Double.parseDouble(NNNN());
        }

        String NNNN() {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

        String nextLine() {
            String spl = "";
            try {
                spl = bufferedReader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return spl;
        }
    }
    /*****************************************************************************/
} public class Main {
    public static void main(String[] args) {
        CP sc = new CP();
        String S = sc.nextLine(), T = sc.nextLine();
        int max = Integer.MIN_VALUE;
        String p = "";
        for (int i = 0; i < S.length() - T.length() + 1; i++) {
            String j = S.substring(i, i + T.length());
            if (max < charMatch(T, j)) {
                max = charMatch(T, j);
                p = j;
            }
        }
        System.out.println(T.length() - charMatch(T, p));
    }

    static int charMatch(String A, String B) {
        int c = 0;
        for (int i = 0; i < A.length(); i++) {
            if (A.charAt(i) == B.charAt(i))
                c++;
        }
        return c;
    }

    /*****************************************************************************/
    static class CP {
        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;

        public CP() {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        }

        int nextInt() {
            return Integer.parseInt(NNNN());
        }

        long nextLong() {
            return Long.parseLong(NNNN());
        }

        double nextDouble() {
            return Double.parseDouble(NNNN());
        }

        String NNNN() {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

        String nextLine() {
            String spl = "";
            try {
                spl = bufferedReader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return spl;
        }
    }
    /*****************************************************************************/
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        CP sc = new CP();
        String S = sc.nextLine(), T = sc.nextLine();
        int max = Integer.MIN_VALUE;
        String p = "";
        for (int i = 0; i < S.length() - T.length() + 1; i++) {
            String j = S.substring(i, i + T.length());
            if (max < charMatch(T, j)) {
                max = charMatch(T, j);
                p = j;
            }
        }
        System.out.println(T.length() - charMatch(T, p));
    }

    static int charMatch(String A, String B) {
        int c = 0;
        for (int i = 0; i < A.length(); i++) {
            if (A.charAt(i) == B.charAt(i))
                c++;
        }
        return c;
    }

    /*****************************************************************************/
    static class CP {
        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;

        public CP() {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        }

        int nextInt() {
            return Integer.parseInt(NNNN());
        }

        long nextLong() {
            return Long.parseLong(NNNN());
        }

        double nextDouble() {
            return Double.parseDouble(NNNN());
        }

        String NNNN() {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

        String nextLine() {
            String spl = "";
            try {
                spl = bufferedReader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return spl;
        }
    }
    /*****************************************************************************/
}