import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Object o = run();
        if (o != null)
            System.out.println(o);
    }

    static Object run() {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            String t = sc.next();
            int resultMin = 10000;
            for (int i = 0; i < s.length() - t.length() + 1; i++) {
                String sSub = s.substring(i, i + t.length());
                int result = 0;

                char[] sa = sSub.toCharArray();
                char[] ta = t.toCharArray();

                for (int j = 0; j < sSub.length(); j++) {
                    if (sa[j] != ta[j]) {
                        result++;
                    }
                }
                resultMin = Math.min(result, resultMin);
            }
            return resultMin;
        }
    }
}

class ChenNumberUtil {
    static Collection<Integer> getDivisors(int n) {
        ArrayList<Integer> al = new ArrayList<>();
        for (int i = 1; i * i <= n; i++) {
            if (n % i == 0) {
                al.add(i);
                if (n / i != i)
                    al.add(n / i);
            }
        }
        Collections.sort(al);
        return al;
    }
}

class ChenBitUtil {
    static int popCount(int bit) {
        return Integer.bitCount(bit);
    }

    static boolean isFlag(int bit, int i) {
        return 0 != (bit & (1 << i));
    }

    static int setTrue(int bit, int i) {
        return bit |= (1 << i);
    }

    static int setFalse(int bit, int i) {
        return bit &= ~(1 << i);
    }

    static int setReverse(int bit, int i) {
        return isFlag(bit, i) ? setFalse(bit, i) : setTrue(bit, i);
    }

    static int reverseAll(int bit) {
        return ~bit;
    }
} import java.util.ArrayList; ArrayList java.util import java.util.Collection; Collection java.util import java.util.Collections; Collections java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Object o = run();
        if (o != null)
            System.out.println(o);
    }

    static Object run() {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            String t = sc.next();
            int resultMin = 10000;
            for (int i = 0; i < s.length() - t.length() + 1; i++) {
                String sSub = s.substring(i, i + t.length());
                int result = 0;

                char[] sa = sSub.toCharArray();
                char[] ta = t.toCharArray();

                for (int j = 0; j < sSub.length(); j++) {
                    if (sa[j] != ta[j]) {
                        result++;
                    }
                }
                resultMin = Math.min(result, resultMin);
            }
            return resultMin;
        }
    }
} Main public static void main(String[] args) {
        Object o = run();
        if (o != null)
            System.out.println(o);
    } main {
        Object o = run();
        if (o != null)
            System.out.println(o);
    } Object o = run(); o run() run if (o != null)
            System.out.println(o); o != null o null System.out.println(o) System.out.println System.out System System.out o String[] args args static Object run() {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            String t = sc.next();
            int resultMin = 10000;
            for (int i = 0; i < s.length() - t.length() + 1; i++) {
                String sSub = s.substring(i, i + t.length());
                int result = 0;

                char[] sa = sSub.toCharArray();
                char[] ta = t.toCharArray();

                for (int j = 0; j < sSub.length(); j++) {
                    if (sa[j] != ta[j]) {
                        result++;
                    }
                }
                resultMin = Math.min(result, resultMin);
            }
            return resultMin;
        }
    } run {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            String t = sc.next();
            int resultMin = 10000;
            for (int i = 0; i < s.length() - t.length() + 1; i++) {
                String sSub = s.substring(i, i + t.length());
                int result = 0;

                char[] sa = sSub.toCharArray();
                char[] ta = t.toCharArray();

                for (int j = 0; j < sSub.length(); j++) {
                    if (sa[j] != ta[j]) {
                        result++;
                    }
                }
                resultMin = Math.min(result, resultMin);
            }
            return resultMin;
        }
    } try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            String t = sc.next();
            int resultMin = 10000;
            for (int i = 0; i < s.length() - t.length() + 1; i++) {
                String sSub = s.substring(i, i + t.length());
                int result = 0;

                char[] sa = sSub.toCharArray();
                char[] ta = t.toCharArray();

                for (int j = 0; j < sSub.length(); j++) {
                    if (sa[j] != ta[j]) {
                        result++;
                    }
                }
                resultMin = Math.min(result, resultMin);
            }
            return resultMin;
        } {
            String s = sc.next();
            String t = sc.next();
            int resultMin = 10000;
            for (int i = 0; i < s.length() - t.length() + 1; i++) {
                String sSub = s.substring(i, i + t.length());
                int result = 0;

                char[] sa = sSub.toCharArray();
                char[] ta = t.toCharArray();

                for (int j = 0; j < sSub.length(); j++) {
                    if (sa[j] != ta[j]) {
                        result++;
                    }
                }
                resultMin = Math.min(result, resultMin);
            }
            return resultMin;
        } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc int resultMin = 10000; resultMin 10000 for (int i = 0; i < s.length() - t.length() + 1; i++) {
                String sSub = s.substring(i, i + t.length());
                int result = 0;

                char[] sa = sSub.toCharArray();
                char[] ta = t.toCharArray();

                for (int j = 0; j < sSub.length(); j++) {
                    if (sa[j] != ta[j]) {
                        result++;
                    }
                }
                resultMin = Math.min(result, resultMin);
            } 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 sSub = s.substring(i, i + t.length());
                int result = 0;

                char[] sa = sSub.toCharArray();
                char[] ta = t.toCharArray();

                for (int j = 0; j < sSub.length(); j++) {
                    if (sa[j] != ta[j]) {
                        result++;
                    }
                }
                resultMin = Math.min(result, resultMin);
            } {
                String sSub = s.substring(i, i + t.length());
                int result = 0;

                char[] sa = sSub.toCharArray();
                char[] ta = t.toCharArray();

                for (int j = 0; j < sSub.length(); j++) {
                    if (sa[j] != ta[j]) {
                        result++;
                    }
                }
                resultMin = Math.min(result, resultMin);
            } String sSub = s.substring(i, i + t.length()); sSub s.substring(i, i + t.length()) s.substring s i i + t.length() i t.length() t.length t int result = 0; result 0 char[] sa = sSub.toCharArray(); sa sSub.toCharArray() sSub.toCharArray sSub char[] ta = t.toCharArray(); ta t.toCharArray() t.toCharArray t for (int j = 0; j < sSub.length(); j++) {
                    if (sa[j] != ta[j]) {
                        result++;
                    }
                } int j = 0; int j = 0; j 0 j < sSub.length() j sSub.length() sSub.length sSub j++ j++ j {
                    if (sa[j] != ta[j]) {
                        result++;
                    }
                } {
                    if (sa[j] != ta[j]) {
                        result++;
                    }
                } if (sa[j] != ta[j]) {
                        result++;
                    } sa[j] != ta[j] sa[j] sa j ta[j] ta j {
                        result++;
                    } result++ result resultMin = Math.min(result, resultMin) resultMin Math.min(result, resultMin) Math.min Math result resultMin return resultMin; resultMin class ChenNumberUtil {
    static Collection<Integer> getDivisors(int n) {
        ArrayList<Integer> al = new ArrayList<>();
        for (int i = 1; i * i <= n; i++) {
            if (n % i == 0) {
                al.add(i);
                if (n / i != i)
                    al.add(n / i);
            }
        }
        Collections.sort(al);
        return al;
    }
} ChenNumberUtil static Collection<Integer> getDivisors(int n) {
        ArrayList<Integer> al = new ArrayList<>();
        for (int i = 1; i * i <= n; i++) {
            if (n % i == 0) {
                al.add(i);
                if (n / i != i)
                    al.add(n / i);
            }
        }
        Collections.sort(al);
        return al;
    } getDivisors {
        ArrayList<Integer> al = new ArrayList<>();
        for (int i = 1; i * i <= n; i++) {
            if (n % i == 0) {
                al.add(i);
                if (n / i != i)
                    al.add(n / i);
            }
        }
        Collections.sort(al);
        return al;
    } ArrayList<Integer> al = new ArrayList<>(); al new ArrayList<>() for (int i = 1; i * i <= n; i++) {
            if (n % i == 0) {
                al.add(i);
                if (n / i != i)
                    al.add(n / i);
            }
        } int i = 1; int i = 1; i 1 i * i <= n i * i i i n i++ i++ i {
            if (n % i == 0) {
                al.add(i);
                if (n / i != i)
                    al.add(n / i);
            }
        } {
            if (n % i == 0) {
                al.add(i);
                if (n / i != i)
                    al.add(n / i);
            }
        } if (n % i == 0) {
                al.add(i);
                if (n / i != i)
                    al.add(n / i);
            } n % i == 0 n % i n i 0 {
                al.add(i);
                if (n / i != i)
                    al.add(n / i);
            } al.add(i) al.add al i if (n / i != i)
                    al.add(n / i); n / i != i n / i n i i al.add(n / i) al.add al n / i n i Collections.sort(al) Collections.sort Collections al return al; al int n n class ChenBitUtil {
    static int popCount(int bit) {
        return Integer.bitCount(bit);
    }

    static boolean isFlag(int bit, int i) {
        return 0 != (bit & (1 << i));
    }

    static int setTrue(int bit, int i) {
        return bit |= (1 << i);
    }

    static int setFalse(int bit, int i) {
        return bit &= ~(1 << i);
    }

    static int setReverse(int bit, int i) {
        return isFlag(bit, i) ? setFalse(bit, i) : setTrue(bit, i);
    }

    static int reverseAll(int bit) {
        return ~bit;
    }
} ChenBitUtil static int popCount(int bit) {
        return Integer.bitCount(bit);
    } popCount {
        return Integer.bitCount(bit);
    } return Integer.bitCount(bit); Integer.bitCount(bit) Integer.bitCount Integer bit int bit bit static boolean isFlag(int bit, int i) {
        return 0 != (bit & (1 << i));
    } isFlag {
        return 0 != (bit & (1 << i));
    } return 0 != (bit & (1 << i)); 0 != (bit & (1 << i)) 0 (bit & (1 << i)) bit (1 << i) 1 i int bit bit int i i static int setTrue(int bit, int i) {
        return bit |= (1 << i);
    } setTrue {
        return bit |= (1 << i);
    } return bit |= (1 << i); bit |= (1 << i) bit (1 << i) 1 i int bit bit int i i static int setFalse(int bit, int i) {
        return bit &= ~(1 << i);
    } setFalse {
        return bit &= ~(1 << i);
    } return bit &= ~(1 << i); bit &= ~(1 << i) bit ~(1 << i) (1 << i) 1 i int bit bit int i i static int setReverse(int bit, int i) {
        return isFlag(bit, i) ? setFalse(bit, i) : setTrue(bit, i);
    } setReverse {
        return isFlag(bit, i) ? setFalse(bit, i) : setTrue(bit, i);
    } return isFlag(bit, i) ? setFalse(bit, i) : setTrue(bit, i); isFlag(bit, i) ? setFalse(bit, i) : setTrue(bit, i) isFlag(bit, i) isFlag bit i setFalse(bit, i) setFalse bit i setTrue(bit, i) setTrue bit i int bit bit int i i static int reverseAll(int bit) {
        return ~bit;
    } reverseAll {
        return ~bit;
    } return ~bit; ~bit bit int bit bit public class Main {
    public static void main(String[] args) {
        Object o = run();
        if (o != null)
            System.out.println(o);
    }

    static Object run() {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            String t = sc.next();
            int resultMin = 10000;
            for (int i = 0; i < s.length() - t.length() + 1; i++) {
                String sSub = s.substring(i, i + t.length());
                int result = 0;

                char[] sa = sSub.toCharArray();
                char[] ta = t.toCharArray();

                for (int j = 0; j < sSub.length(); j++) {
                    if (sa[j] != ta[j]) {
                        result++;
                    }
                }
                resultMin = Math.min(result, resultMin);
            }
            return resultMin;
        }
    }
} public class Main {
    public static void main(String[] args) {
        Object o = run();
        if (o != null)
            System.out.println(o);
    }

    static Object run() {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            String t = sc.next();
            int resultMin = 10000;
            for (int i = 0; i < s.length() - t.length() + 1; i++) {
                String sSub = s.substring(i, i + t.length());
                int result = 0;

                char[] sa = sSub.toCharArray();
                char[] ta = t.toCharArray();

                for (int j = 0; j < sSub.length(); j++) {
                    if (sa[j] != ta[j]) {
                        result++;
                    }
                }
                resultMin = Math.min(result, resultMin);
            }
            return resultMin;
        }
    }
} Main
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Object o = run();
        if (o != null)
            System.out.println(o);
    }

    static Object run() {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            String t = sc.next();
            int resultMin = 10000;
            for (int i = 0; i < s.length() - t.length() + 1; i++) {
                String sSub = s.substring(i, i + t.length());
                int result = 0;

                char[] sa = sSub.toCharArray();
                char[] ta = t.toCharArray();

                for (int j = 0; j < sSub.length(); j++) {
                    if (sa[j] != ta[j]) {
                        result++;
                    }
                }
                resultMin = Math.min(result, resultMin);
            }
            return resultMin;
        }
    }
}

class ChenNumberUtil {
    static Collection<Integer> getDivisors(int n) {
        ArrayList<Integer> al = new ArrayList<>();
        for (int i = 1; i * i <= n; i++) {
            if (n % i == 0) {
                al.add(i);
                if (n / i != i)
                    al.add(n / i);
            }
        }
        Collections.sort(al);
        return al;
    }
}

class ChenBitUtil {
    static int popCount(int bit) {
        return Integer.bitCount(bit);
    }

    static boolean isFlag(int bit, int i) {
        return 0 != (bit & (1 << i));
    }

    static int setTrue(int bit, int i) {
        return bit |= (1 << i);
    }

    static int setFalse(int bit, int i) {
        return bit &= ~(1 << i);
    }

    static int setReverse(int bit, int i) {
        return isFlag(bit, i) ? setFalse(bit, i) : setTrue(bit, i);
    }

    static int reverseAll(int bit) {
        return ~bit;
    }
}