import java.util.*;
public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
        char[] S = sc.next().toCharArray();
        char[] T = sc.next().toCharArray();

        int res=1000;

        for(int i=0; i<S.length-T.length+1; i++){
            int count=T.length;
            for(int j=0; j<T.length; j++){
                if(S[i+j]==T[j]){
                    count--;
                }
            }
            res = Math.min(res,count);
        }
        
        System.out.println(res);
}

}
 import java.util.*; util.* java public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
        char[] S = sc.next().toCharArray();
        char[] T = sc.next().toCharArray();

        int res=1000;

        for(int i=0; i<S.length-T.length+1; i++){
            int count=T.length;
            for(int j=0; j<T.length; j++){
                if(S[i+j]==T[j]){
                    count--;
                }
            }
            res = Math.min(res,count);
        }
        
        System.out.println(res);
}

} Main private static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args){
        char[] S = sc.next().toCharArray();
        char[] T = sc.next().toCharArray();

        int res=1000;

        for(int i=0; i<S.length-T.length+1; i++){
            int count=T.length;
            for(int j=0; j<T.length; j++){
                if(S[i+j]==T[j]){
                    count--;
                }
            }
            res = Math.min(res,count);
        }
        
        System.out.println(res);
} main {
        char[] S = sc.next().toCharArray();
        char[] T = sc.next().toCharArray();

        int res=1000;

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

        int res=1000;

        for(int i=0; i<S.length-T.length+1; i++){
            int count=T.length;
            for(int j=0; j<T.length; j++){
                if(S[i+j]==T[j]){
                    count--;
                }
            }
            res = Math.min(res,count);
        }
        
        System.out.println(res);
}

} public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
        char[] S = sc.next().toCharArray();
        char[] T = sc.next().toCharArray();

        int res=1000;

        for(int i=0; i<S.length-T.length+1; i++){
            int count=T.length;
            for(int j=0; j<T.length; j++){
                if(S[i+j]==T[j]){
                    count--;
                }
            }
            res = Math.min(res,count);
        }
        
        System.out.println(res);
}

} Main
import java.util.*;
public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
        char[] S = sc.next().toCharArray();
        char[] T = sc.next().toCharArray();

        int res=1000;

        for(int i=0; i<S.length-T.length+1; i++){
            int count=T.length;
            for(int j=0; j<T.length; j++){
                if(S[i+j]==T[j]){
                    count--;
                }
            }
            res = Math.min(res,count);
        }
        
        System.out.println(res);
}

}

