import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BSubstring solver = new BSubstring();
        solver.solve(1, in, out);
        out.close();
    }

    static class BSubstring {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();
            String T = in.next();
            int match_cnt = 0;
            int ans = 0;
            for (int i = 0; i <= S.length() - T.length(); i++) {
                String tmp = S.substring(i, i + T.length());
                match_cnt = Math.max(match_cnt, cnt(tmp, T));
            }
            ans = T.length() - match_cnt;
            // 出力
            out.println(ans);

        }

        int cnt(String S, String T) {
            int res = 0;
            for (int i = 0; i < T.length(); i++) {
                if (S.charAt(i) == T.charAt(i)) res++;
            }
            return res;
        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BSubstring solver = new BSubstring();
        solver.solve(1, in, out);
        out.close();
    }

    static class BSubstring {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();
            String T = in.next();
            int match_cnt = 0;
            int ans = 0;
            for (int i = 0; i <= S.length() - T.length(); i++) {
                String tmp = S.substring(i, i + T.length());
                match_cnt = Math.max(match_cnt, cnt(tmp, T));
            }
            ans = T.length() - match_cnt;
            // 出力
            out.println(ans);

        }

        int cnt(String S, String T) {
            int res = 0;
            for (int i = 0; i < T.length(); i++) {
                if (S.charAt(i) == T.charAt(i)) res++;
            }
            return res;
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BSubstring solver = new BSubstring();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BSubstring solver = new BSubstring();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) BSubstring solver = new BSubstring(); solver new BSubstring() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class BSubstring {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();
            String T = in.next();
            int match_cnt = 0;
            int ans = 0;
            for (int i = 0; i <= S.length() - T.length(); i++) {
                String tmp = S.substring(i, i + T.length());
                match_cnt = Math.max(match_cnt, cnt(tmp, T));
            }
            ans = T.length() - match_cnt;
            // 出力
            out.println(ans);

        }

        int cnt(String S, String T) {
            int res = 0;
            for (int i = 0; i < T.length(); i++) {
                if (S.charAt(i) == T.charAt(i)) res++;
            }
            return res;
        }

    } BSubstring public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();
            String T = in.next();
            int match_cnt = 0;
            int ans = 0;
            for (int i = 0; i <= S.length() - T.length(); i++) {
                String tmp = S.substring(i, i + T.length());
                match_cnt = Math.max(match_cnt, cnt(tmp, T));
            }
            ans = T.length() - match_cnt;
            // 出力
            out.println(ans);

        } solve {
            // 入力
            String S = in.next();
            String T = in.next();
            int match_cnt = 0;
            int ans = 0;
            for (int i = 0; i <= S.length() - T.length(); i++) {
                String tmp = S.substring(i, i + T.length());
                match_cnt = Math.max(match_cnt, cnt(tmp, T));
            }
            ans = T.length() - match_cnt;
            // 出力
            out.println(ans);

        } String S = in.next(); S in.next() in.next in String T = in.next(); T in.next() in.next in int match_cnt = 0; match_cnt 0 int ans = 0; ans 0 for (int i = 0; i <= S.length() - T.length(); i++) {
                String tmp = S.substring(i, i + T.length());
                match_cnt = Math.max(match_cnt, cnt(tmp, T));
            } int i = 0; int i = 0; i 0 i <= S.length() - T.length() i S.length() - T.length() S.length() S.length S T.length() T.length T i++ i++ i {
                String tmp = S.substring(i, i + T.length());
                match_cnt = Math.max(match_cnt, cnt(tmp, T));
            } {
                String tmp = S.substring(i, i + T.length());
                match_cnt = Math.max(match_cnt, cnt(tmp, T));
            } String tmp = S.substring(i, i + T.length()); tmp S.substring(i, i + T.length()) S.substring S i i + T.length() i T.length() T.length T match_cnt = Math.max(match_cnt, cnt(tmp, T)) match_cnt Math.max(match_cnt, cnt(tmp, T)) Math.max Math match_cnt cnt(tmp, T) cnt tmp T ans = T.length() - match_cnt ans T.length() - match_cnt T.length() T.length T match_cnt out.println(ans) out.println out ans int testNumber testNumber Scanner in in PrintWriter out out int cnt(String S, String T) {
            int res = 0;
            for (int i = 0; i < T.length(); i++) {
                if (S.charAt(i) == T.charAt(i)) res++;
            }
            return res;
        } cnt {
            int res = 0;
            for (int i = 0; i < T.length(); i++) {
                if (S.charAt(i) == T.charAt(i)) res++;
            }
            return res;
        } int res = 0; res 0 for (int i = 0; i < T.length(); i++) {
                if (S.charAt(i) == T.charAt(i)) res++;
            } int i = 0; int i = 0; i 0 i < T.length() i T.length() T.length T i++ i++ i {
                if (S.charAt(i) == T.charAt(i)) res++;
            } {
                if (S.charAt(i) == T.charAt(i)) res++;
            } if (S.charAt(i) == T.charAt(i)) res++; S.charAt(i) == T.charAt(i) S.charAt(i) S.charAt S i T.charAt(i) T.charAt T i res++ res return res; res String S S String T T public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BSubstring solver = new BSubstring();
        solver.solve(1, in, out);
        out.close();
    }

    static class BSubstring {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();
            String T = in.next();
            int match_cnt = 0;
            int ans = 0;
            for (int i = 0; i <= S.length() - T.length(); i++) {
                String tmp = S.substring(i, i + T.length());
                match_cnt = Math.max(match_cnt, cnt(tmp, T));
            }
            ans = T.length() - match_cnt;
            // 出力
            out.println(ans);

        }

        int cnt(String S, String T) {
            int res = 0;
            for (int i = 0; i < T.length(); i++) {
                if (S.charAt(i) == T.charAt(i)) res++;
            }
            return res;
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BSubstring solver = new BSubstring();
        solver.solve(1, in, out);
        out.close();
    }

    static class BSubstring {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();
            String T = in.next();
            int match_cnt = 0;
            int ans = 0;
            for (int i = 0; i <= S.length() - T.length(); i++) {
                String tmp = S.substring(i, i + T.length());
                match_cnt = Math.max(match_cnt, cnt(tmp, T));
            }
            ans = T.length() - match_cnt;
            // 出力
            out.println(ans);

        }

        int cnt(String S, String T) {
            int res = 0;
            for (int i = 0; i < T.length(); i++) {
                if (S.charAt(i) == T.charAt(i)) res++;
            }
            return res;
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BSubstring solver = new BSubstring();
        solver.solve(1, in, out);
        out.close();
    }

    static class BSubstring {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();
            String T = in.next();
            int match_cnt = 0;
            int ans = 0;
            for (int i = 0; i <= S.length() - T.length(); i++) {
                String tmp = S.substring(i, i + T.length());
                match_cnt = Math.max(match_cnt, cnt(tmp, T));
            }
            ans = T.length() - match_cnt;
            // 出力
            out.println(ans);

        }

        int cnt(String S, String T) {
            int res = 0;
            for (int i = 0; i < T.length(); i++) {
                if (S.charAt(i) == T.charAt(i)) res++;
            }
            return res;
        }

    }
}

