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
 *
 * @author test
 */
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);
        abc177_b solver = new abc177_b();
        solver.solve(1, in, out);
        out.close();
    }

    static class abc177_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.next();
            String T = in.next();

            int mincnt = 1001;
            for (int i = 0; i < (S.length() - T.length()) + 1; i++) {
                int umcnt = 0;
                for (int j = 0; j < T.length(); j++) {
                    if (S.charAt(i + j) != T.charAt(j)) {
                        umcnt++;
                    }
                }
                mincnt = Integer.min(mincnt, umcnt);
            }
            out.println(mincnt);
        }

    }
}
 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);
        abc177_b solver = new abc177_b();
        solver.solve(1, in, out);
        out.close();
    }

    static class abc177_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.next();
            String T = in.next();

            int mincnt = 1001;
            for (int i = 0; i < (S.length() - T.length()) + 1; i++) {
                int umcnt = 0;
                for (int j = 0; j < T.length(); j++) {
                    if (S.charAt(i + j) != T.charAt(j)) {
                        umcnt++;
                    }
                }
                mincnt = Integer.min(mincnt, umcnt);
            }
            out.println(mincnt);
        }

    }
} 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);
        abc177_b solver = new abc177_b();
        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);
        abc177_b solver = new abc177_b();
        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) abc177_b solver = new abc177_b(); solver new abc177_b() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class abc177_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.next();
            String T = in.next();

            int mincnt = 1001;
            for (int i = 0; i < (S.length() - T.length()) + 1; i++) {
                int umcnt = 0;
                for (int j = 0; j < T.length(); j++) {
                    if (S.charAt(i + j) != T.charAt(j)) {
                        umcnt++;
                    }
                }
                mincnt = Integer.min(mincnt, umcnt);
            }
            out.println(mincnt);
        }

    } abc177_b public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.next();
            String T = in.next();

            int mincnt = 1001;
            for (int i = 0; i < (S.length() - T.length()) + 1; i++) {
                int umcnt = 0;
                for (int j = 0; j < T.length(); j++) {
                    if (S.charAt(i + j) != T.charAt(j)) {
                        umcnt++;
                    }
                }
                mincnt = Integer.min(mincnt, umcnt);
            }
            out.println(mincnt);
        } solve {
            String S = in.next();
            String T = in.next();

            int mincnt = 1001;
            for (int i = 0; i < (S.length() - T.length()) + 1; i++) {
                int umcnt = 0;
                for (int j = 0; j < T.length(); j++) {
                    if (S.charAt(i + j) != T.charAt(j)) {
                        umcnt++;
                    }
                }
                mincnt = Integer.min(mincnt, umcnt);
            }
            out.println(mincnt);
        } String S = in.next(); S in.next() in.next in String T = in.next(); T in.next() in.next in int mincnt = 1001; mincnt 1001 for (int i = 0; i < (S.length() - T.length()) + 1; i++) {
                int umcnt = 0;
                for (int j = 0; j < T.length(); j++) {
                    if (S.charAt(i + j) != T.charAt(j)) {
                        umcnt++;
                    }
                }
                mincnt = Integer.min(mincnt, umcnt);
            } 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 umcnt = 0;
                for (int j = 0; j < T.length(); j++) {
                    if (S.charAt(i + j) != T.charAt(j)) {
                        umcnt++;
                    }
                }
                mincnt = Integer.min(mincnt, umcnt);
            } {
                int umcnt = 0;
                for (int j = 0; j < T.length(); j++) {
                    if (S.charAt(i + j) != T.charAt(j)) {
                        umcnt++;
                    }
                }
                mincnt = Integer.min(mincnt, umcnt);
            } int umcnt = 0; umcnt 0 for (int j = 0; j < T.length(); j++) {
                    if (S.charAt(i + j) != T.charAt(j)) {
                        umcnt++;
                    }
                } int j = 0; int j = 0; j 0 j < T.length() j T.length() T.length T j++ j++ j {
                    if (S.charAt(i + j) != T.charAt(j)) {
                        umcnt++;
                    }
                } {
                    if (S.charAt(i + j) != T.charAt(j)) {
                        umcnt++;
                    }
                } if (S.charAt(i + j) != T.charAt(j)) {
                        umcnt++;
                    } 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 {
                        umcnt++;
                    } umcnt++ umcnt mincnt = Integer.min(mincnt, umcnt) mincnt Integer.min(mincnt, umcnt) Integer.min Integer mincnt umcnt out.println(mincnt) out.println out mincnt int testNumber testNumber Scanner in in PrintWriter out out 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);
        abc177_b solver = new abc177_b();
        solver.solve(1, in, out);
        out.close();
    }

    static class abc177_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.next();
            String T = in.next();

            int mincnt = 1001;
            for (int i = 0; i < (S.length() - T.length()) + 1; i++) {
                int umcnt = 0;
                for (int j = 0; j < T.length(); j++) {
                    if (S.charAt(i + j) != T.charAt(j)) {
                        umcnt++;
                    }
                }
                mincnt = Integer.min(mincnt, umcnt);
            }
            out.println(mincnt);
        }

    }
} 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);
        abc177_b solver = new abc177_b();
        solver.solve(1, in, out);
        out.close();
    }

    static class abc177_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.next();
            String T = in.next();

            int mincnt = 1001;
            for (int i = 0; i < (S.length() - T.length()) + 1; i++) {
                int umcnt = 0;
                for (int j = 0; j < T.length(); j++) {
                    if (S.charAt(i + j) != T.charAt(j)) {
                        umcnt++;
                    }
                }
                mincnt = Integer.min(mincnt, umcnt);
            }
            out.println(mincnt);
        }

    }
} 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
 *
 * @author test
 */
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);
        abc177_b solver = new abc177_b();
        solver.solve(1, in, out);
        out.close();
    }

    static class abc177_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.next();
            String T = in.next();

            int mincnt = 1001;
            for (int i = 0; i < (S.length() - T.length()) + 1; i++) {
                int umcnt = 0;
                for (int j = 0; j < T.length(); j++) {
                    if (S.charAt(i + j) != T.charAt(j)) {
                        umcnt++;
                    }
                }
                mincnt = Integer.min(mincnt, umcnt);
            }
            out.println(mincnt);
        }

    }
}

