import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int max = 0;
        for (int i = 0; i < S.length()-T.length()+1; i++) {
            String now = S.substring(i, i+T.length());
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) == now.charAt(j)) {
                    count++;
                }
            }
            max = Math.max(max, count);
        }
        System.out.println(T.length()-max);
    }
} import java.util.*; util.* java public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int max = 0;
        for (int i = 0; i < S.length()-T.length()+1; i++) {
            String now = S.substring(i, i+T.length());
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) == now.charAt(j)) {
                    count++;
                }
            }
            max = Math.max(max, count);
        }
        System.out.println(T.length()-max);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int max = 0;
        for (int i = 0; i < S.length()-T.length()+1; i++) {
            String now = S.substring(i, i+T.length());
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) == now.charAt(j)) {
                    count++;
                }
            }
            max = Math.max(max, count);
        }
        System.out.println(T.length()-max);
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int max = 0;
        for (int i = 0; i < S.length()-T.length()+1; i++) {
            String now = S.substring(i, i+T.length());
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) == now.charAt(j)) {
                    count++;
                }
            }
            max = Math.max(max, count);
        }
        System.out.println(T.length()-max);
    } Scanner sc = new Scanner(System.in); sc 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 max = 0; max 0 for (int i = 0; i < S.length()-T.length()+1; i++) {
            String now = S.substring(i, i+T.length());
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) == now.charAt(j)) {
                    count++;
                }
            }
            max = Math.max(max, count);
        } 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 now = S.substring(i, i+T.length());
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) == now.charAt(j)) {
                    count++;
                }
            }
            max = Math.max(max, count);
        } {
            String now = S.substring(i, i+T.length());
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) == now.charAt(j)) {
                    count++;
                }
            }
            max = Math.max(max, count);
        } String now = S.substring(i, i+T.length()); now S.substring(i, i+T.length()) S.substring S i i+T.length() i T.length() T.length T int count = 0; count 0 for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) == now.charAt(j)) {
                    count++;
                }
            } int j = 0; int j = 0; j 0 j < T.length() j T.length() T.length T j++ j++ j {
                if (T.charAt(j) == now.charAt(j)) {
                    count++;
                }
            } {
                if (T.charAt(j) == now.charAt(j)) {
                    count++;
                }
            } if (T.charAt(j) == now.charAt(j)) {
                    count++;
                } T.charAt(j) == now.charAt(j) T.charAt(j) T.charAt T j now.charAt(j) now.charAt now j {
                    count++;
                } count++ count max = Math.max(max, count) max Math.max(max, count) Math.max Math max count System.out.println(T.length()-max) System.out.println System.out System System.out T.length()-max T.length() T.length T max String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int max = 0;
        for (int i = 0; i < S.length()-T.length()+1; i++) {
            String now = S.substring(i, i+T.length());
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) == now.charAt(j)) {
                    count++;
                }
            }
            max = Math.max(max, count);
        }
        System.out.println(T.length()-max);
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int max = 0;
        for (int i = 0; i < S.length()-T.length()+1; i++) {
            String now = S.substring(i, i+T.length());
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) == now.charAt(j)) {
                    count++;
                }
            }
            max = Math.max(max, count);
        }
        System.out.println(T.length()-max);
    }
} Main
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int max = 0;
        for (int i = 0; i < S.length()-T.length()+1; i++) {
            String now = S.substring(i, i+T.length());
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) == now.charAt(j)) {
                    count++;
                }
            }
            max = Math.max(max, count);
        }
        System.out.println(T.length()-max);
    }
}
