import java.util.*;


public class Main {

    static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
    static long mod = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] S = sc.next().toCharArray();
        char[] T = sc.next().toCharArray();
        int ans = 1001;
        for(int i=0;i<S.length-T.length+1;i++){
            int tempAns=0;
            for(int j=0;j<T.length;j++){
                if(S[i+j] != T[j]){
                    tempAns++;
                }
            }
            ans = Math.min(ans,tempAns);
        }
        System.out.println(ans);

    }

}

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

    static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
    static long mod = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] S = sc.next().toCharArray();
        char[] T = sc.next().toCharArray();
        int ans = 1001;
        for(int i=0;i<S.length-T.length+1;i++){
            int tempAns=0;
            for(int j=0;j<T.length;j++){
                if(S[i+j] != T[j]){
                    tempAns++;
                }
            }
            ans = Math.min(ans,tempAns);
        }
        System.out.println(ans);

    }

} Main static long mod = 1000000007; mod 1000000007 static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;} gcd {return b>0?gcd(b,a%b):a;} return b>0?gcd(b,a%b):a; b>0?gcd(b,a%b):a b>0 b 0 gcd(b,a%b) gcd b a%b a b a int a a int b b public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] S = sc.next().toCharArray();
        char[] T = sc.next().toCharArray();
        int ans = 1001;
        for(int i=0;i<S.length-T.length+1;i++){
            int tempAns=0;
            for(int j=0;j<T.length;j++){
                if(S[i+j] != T[j]){
                    tempAns++;
                }
            }
            ans = Math.min(ans,tempAns);
        }
        System.out.println(ans);

    } main {
        Scanner sc = new Scanner(System.in);
        char[] S = sc.next().toCharArray();
        char[] T = sc.next().toCharArray();
        int ans = 1001;
        for(int i=0;i<S.length-T.length+1;i++){
            int tempAns=0;
            for(int j=0;j<T.length;j++){
                if(S[i+j] != T[j]){
                    tempAns++;
                }
            }
            ans = Math.min(ans,tempAns);
        }
        System.out.println(ans);

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] S = sc.next().toCharArray(); S sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc char[] T = sc.next().toCharArray(); T sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc int ans = 1001; ans 1001 for(int i=0;i<S.length-T.length+1;i++){
            int tempAns=0;
            for(int j=0;j<T.length;j++){
                if(S[i+j] != T[j]){
                    tempAns++;
                }
            }
            ans = Math.min(ans,tempAns);
        } 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 S.length T.length T T.length 1 i++ i++ i {
            int tempAns=0;
            for(int j=0;j<T.length;j++){
                if(S[i+j] != T[j]){
                    tempAns++;
                }
            }
            ans = Math.min(ans,tempAns);
        } {
            int tempAns=0;
            for(int j=0;j<T.length;j++){
                if(S[i+j] != T[j]){
                    tempAns++;
                }
            }
            ans = Math.min(ans,tempAns);
        } int tempAns=0; tempAns 0 for(int j=0;j<T.length;j++){
                if(S[i+j] != T[j]){
                    tempAns++;
                }
            } int j=0; int j=0; j 0 j<T.length j T.length T T.length j++ j++ j {
                if(S[i+j] != T[j]){
                    tempAns++;
                }
            } {
                if(S[i+j] != T[j]){
                    tempAns++;
                }
            } if(S[i+j] != T[j]){
                    tempAns++;
                } S[i+j] != T[j] S[i+j] S i+j i j T[j] T j {
                    tempAns++;
                } tempAns++ tempAns ans = Math.min(ans,tempAns) ans Math.min(ans,tempAns) Math.min Math ans tempAns System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

    static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
    static long mod = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] S = sc.next().toCharArray();
        char[] T = sc.next().toCharArray();
        int ans = 1001;
        for(int i=0;i<S.length-T.length+1;i++){
            int tempAns=0;
            for(int j=0;j<T.length;j++){
                if(S[i+j] != T[j]){
                    tempAns++;
                }
            }
            ans = Math.min(ans,tempAns);
        }
        System.out.println(ans);

    }

} public class Main {

    static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
    static long mod = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] S = sc.next().toCharArray();
        char[] T = sc.next().toCharArray();
        int ans = 1001;
        for(int i=0;i<S.length-T.length+1;i++){
            int tempAns=0;
            for(int j=0;j<T.length;j++){
                if(S[i+j] != T[j]){
                    tempAns++;
                }
            }
            ans = Math.min(ans,tempAns);
        }
        System.out.println(ans);

    }

} Main
import java.util.*;


public class Main {

    static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
    static long mod = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] S = sc.next().toCharArray();
        char[] T = sc.next().toCharArray();
        int ans = 1001;
        for(int i=0;i<S.length-T.length+1;i++){
            int tempAns=0;
            for(int j=0;j<T.length;j++){
                if(S[i+j] != T[j]){
                    tempAns++;
                }
            }
            ans = Math.min(ans,tempAns);
        }
        System.out.println(ans);

    }

}


