import java.util.*;

public class Main {

    private static final Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        String S = scanner.next();
        String T = scanner.next();
        int slen = S.length(), tlen = T.length(), res = 0;
        for (int i = 0; i < slen - tlen + 1; ++i) {
            int cur = 0;
            for (int j = 0; j < tlen; ++j) {
                if (i + j < slen && S.charAt(i + j) == T.charAt(j)) cur += 1;
            }
            res = Math.max(res, cur);
        }
        System.out.println(tlen - res);
    }

} import java.util.*; util.* java public class Main {

    private static final Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        String S = scanner.next();
        String T = scanner.next();
        int slen = S.length(), tlen = T.length(), res = 0;
        for (int i = 0; i < slen - tlen + 1; ++i) {
            int cur = 0;
            for (int j = 0; j < tlen; ++j) {
                if (i + j < slen && S.charAt(i + j) == T.charAt(j)) cur += 1;
            }
            res = Math.max(res, cur);
        }
        System.out.println(tlen - res);
    }

} Main private static final Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) public static void main(String[] args) {
        String S = scanner.next();
        String T = scanner.next();
        int slen = S.length(), tlen = T.length(), res = 0;
        for (int i = 0; i < slen - tlen + 1; ++i) {
            int cur = 0;
            for (int j = 0; j < tlen; ++j) {
                if (i + j < slen && S.charAt(i + j) == T.charAt(j)) cur += 1;
            }
            res = Math.max(res, cur);
        }
        System.out.println(tlen - res);
    } main {
        String S = scanner.next();
        String T = scanner.next();
        int slen = S.length(), tlen = T.length(), res = 0;
        for (int i = 0; i < slen - tlen + 1; ++i) {
            int cur = 0;
            for (int j = 0; j < tlen; ++j) {
                if (i + j < slen && S.charAt(i + j) == T.charAt(j)) cur += 1;
            }
            res = Math.max(res, cur);
        }
        System.out.println(tlen - res);
    } String S = scanner.next(); S scanner.next() scanner.next scanner String T = scanner.next(); T scanner.next() scanner.next scanner int slen = S.length() slen S.length() S.length S tlen = T.length() tlen T.length() T.length T res = 0; res 0 for (int i = 0; i < slen - tlen + 1; ++i) {
            int cur = 0;
            for (int j = 0; j < tlen; ++j) {
                if (i + j < slen && S.charAt(i + j) == T.charAt(j)) cur += 1;
            }
            res = Math.max(res, cur);
        } int i = 0; int i = 0; i 0 i < slen - tlen + 1 i slen - tlen + 1 slen - tlen slen tlen 1 ++i ++i i {
            int cur = 0;
            for (int j = 0; j < tlen; ++j) {
                if (i + j < slen && S.charAt(i + j) == T.charAt(j)) cur += 1;
            }
            res = Math.max(res, cur);
        } {
            int cur = 0;
            for (int j = 0; j < tlen; ++j) {
                if (i + j < slen && S.charAt(i + j) == T.charAt(j)) cur += 1;
            }
            res = Math.max(res, cur);
        } int cur = 0; cur 0 for (int j = 0; j < tlen; ++j) {
                if (i + j < slen && S.charAt(i + j) == T.charAt(j)) cur += 1;
            } int j = 0; int j = 0; j 0 j < tlen j tlen ++j ++j j {
                if (i + j < slen && S.charAt(i + j) == T.charAt(j)) cur += 1;
            } {
                if (i + j < slen && S.charAt(i + j) == T.charAt(j)) cur += 1;
            } if (i + j < slen && S.charAt(i + j) == T.charAt(j)) cur += 1; i + j < slen && S.charAt(i + j) == T.charAt(j) i + j < slen i + j i j slen 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 cur += 1 cur 1 res = Math.max(res, cur) res Math.max(res, cur) Math.max Math res cur System.out.println(tlen - res) System.out.println System.out System System.out tlen - res tlen res String[] args args public class Main {

    private static final Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        String S = scanner.next();
        String T = scanner.next();
        int slen = S.length(), tlen = T.length(), res = 0;
        for (int i = 0; i < slen - tlen + 1; ++i) {
            int cur = 0;
            for (int j = 0; j < tlen; ++j) {
                if (i + j < slen && S.charAt(i + j) == T.charAt(j)) cur += 1;
            }
            res = Math.max(res, cur);
        }
        System.out.println(tlen - res);
    }

} public class Main {

    private static final Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        String S = scanner.next();
        String T = scanner.next();
        int slen = S.length(), tlen = T.length(), res = 0;
        for (int i = 0; i < slen - tlen + 1; ++i) {
            int cur = 0;
            for (int j = 0; j < tlen; ++j) {
                if (i + j < slen && S.charAt(i + j) == T.charAt(j)) cur += 1;
            }
            res = Math.max(res, cur);
        }
        System.out.println(tlen - res);
    }

} Main
import java.util.*;

public class Main {

    private static final Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        String S = scanner.next();
        String T = scanner.next();
        int slen = S.length(), tlen = T.length(), res = 0;
        for (int i = 0; i < slen - tlen + 1; ++i) {
            int cur = 0;
            for (int j = 0; j < tlen; ++j) {
                if (i + j < slen && S.charAt(i + j) == T.charAt(j)) cur += 1;
            }
            res = Math.max(res, cur);
        }
        System.out.println(tlen - res);
    }

}