import java.util.*; 
import java.io.*;

//the answer must be bountry * bountry
public class Main  {
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
 
        String S = next();
        String T = next();
        
        int ans = Integer.MAX_VALUE;

        for (int i=1; i<=S.length()-T.length()+1; i++) {
             String temp = S.substring(i-1, i-1+T.length());
             int count = 0;
             for (int j=1; j<=T.length(); j++) {
                if(!temp.substring(j-1,j).equals(T.substring(j-1,j))){
                    count ++;
                }
             };  
             
             ans = Math.min(ans, count);
        }

        System.out.println(ans);
 
    }
    
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main  {
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
 
        String S = next();
        String T = next();
        
        int ans = Integer.MAX_VALUE;

        for (int i=1; i<=S.length()-T.length()+1; i++) {
             String temp = S.substring(i-1, i-1+T.length());
             int count = 0;
             for (int j=1; j<=T.length(); j++) {
                if(!temp.substring(j-1,j).equals(T.substring(j-1,j))){
                    count ++;
                }
             };  
             
             ans = Math.min(ans, count);
        }

        System.out.println(ans);
 
    }
    
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
} Main static StringTokenizer st; st static BufferedReader br; br static PrintWriter out; out public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
 
        String S = next();
        String T = next();
        
        int ans = Integer.MAX_VALUE;

        for (int i=1; i<=S.length()-T.length()+1; i++) {
             String temp = S.substring(i-1, i-1+T.length());
             int count = 0;
             for (int j=1; j<=T.length(); j++) {
                if(!temp.substring(j-1,j).equals(T.substring(j-1,j))){
                    count ++;
                }
             };  
             
             ans = Math.min(ans, count);
        }

        System.out.println(ans);
 
    } main {
        br = new BufferedReader(new InputStreamReader(System.in));
 
        String S = next();
        String T = next();
        
        int ans = Integer.MAX_VALUE;

        for (int i=1; i<=S.length()-T.length()+1; i++) {
             String temp = S.substring(i-1, i-1+T.length());
             int count = 0;
             for (int j=1; j<=T.length(); j++) {
                if(!temp.substring(j-1,j).equals(T.substring(j-1,j))){
                    count ++;
                }
             };  
             
             ans = Math.min(ans, count);
        }

        System.out.println(ans);
 
    } br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) String S = next(); S next() next String T = next(); T next() next int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i=1; i<=S.length()-T.length()+1; i++) {
             String temp = S.substring(i-1, i-1+T.length());
             int count = 0;
             for (int j=1; j<=T.length(); j++) {
                if(!temp.substring(j-1,j).equals(T.substring(j-1,j))){
                    count ++;
                }
             };  
             
             ans = Math.min(ans, count);
        } int i=1; int i=1; i 1 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 temp = S.substring(i-1, i-1+T.length());
             int count = 0;
             for (int j=1; j<=T.length(); j++) {
                if(!temp.substring(j-1,j).equals(T.substring(j-1,j))){
                    count ++;
                }
             };  
             
             ans = Math.min(ans, count);
        } {
             String temp = S.substring(i-1, i-1+T.length());
             int count = 0;
             for (int j=1; j<=T.length(); j++) {
                if(!temp.substring(j-1,j).equals(T.substring(j-1,j))){
                    count ++;
                }
             };  
             
             ans = Math.min(ans, count);
        } String temp = S.substring(i-1, i-1+T.length()); temp S.substring(i-1, i-1+T.length()) S.substring S i-1 i 1 i-1+T.length() i-1 i 1 T.length() T.length T int count = 0; count 0 for (int j=1; j<=T.length(); j++) {
                if(!temp.substring(j-1,j).equals(T.substring(j-1,j))){
                    count ++;
                }
             } int j=1; int j=1; j 1 j<=T.length() j T.length() T.length T j++ j++ j {
                if(!temp.substring(j-1,j).equals(T.substring(j-1,j))){
                    count ++;
                }
             } {
                if(!temp.substring(j-1,j).equals(T.substring(j-1,j))){
                    count ++;
                }
             } if(!temp.substring(j-1,j).equals(T.substring(j-1,j))){
                    count ++;
                } !temp.substring(j-1,j).equals(T.substring(j-1,j)) temp.substring(j-1,j).equals(T.substring(j-1,j)) temp.substring(j-1,j).equals temp.substring(j-1,j) temp.substring temp j-1 j 1 j T.substring(j-1,j) T.substring T j-1 j 1 j {
                    count ++;
                } count ++ count ans = Math.min(ans, count) ans Math.min(ans, count) Math.min Math ans count System.out.println(ans) System.out.println System.out System System.out ans String[] args args public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    } nextInt {
        return Integer.parseInt(next());
    } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public static long nextLong() throws IOException {
        return Long.parseLong(next());
    } nextLong {
        return Long.parseLong(next());
    } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    } nextDouble {
        return Double.parseDouble(next());
    } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    } next {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    } while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim()); st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st st = new StringTokenizer(br.readLine().trim()) st new StringTokenizer(br.readLine().trim()) return st.nextToken(); st.nextToken() st.nextToken st public class Main  {
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
 
        String S = next();
        String T = next();
        
        int ans = Integer.MAX_VALUE;

        for (int i=1; i<=S.length()-T.length()+1; i++) {
             String temp = S.substring(i-1, i-1+T.length());
             int count = 0;
             for (int j=1; j<=T.length(); j++) {
                if(!temp.substring(j-1,j).equals(T.substring(j-1,j))){
                    count ++;
                }
             };  
             
             ans = Math.min(ans, count);
        }

        System.out.println(ans);
 
    }
    
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
} public class Main  {
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
 
        String S = next();
        String T = next();
        
        int ans = Integer.MAX_VALUE;

        for (int i=1; i<=S.length()-T.length()+1; i++) {
             String temp = S.substring(i-1, i-1+T.length());
             int count = 0;
             for (int j=1; j<=T.length(); j++) {
                if(!temp.substring(j-1,j).equals(T.substring(j-1,j))){
                    count ++;
                }
             };  
             
             ans = Math.min(ans, count);
        }

        System.out.println(ans);
 
    }
    
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
} Main
import java.util.*; 
import java.io.*;

//the answer must be bountry * bountry
public class Main  {
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
 
        String S = next();
        String T = next();
        
        int ans = Integer.MAX_VALUE;

        for (int i=1; i<=S.length()-T.length()+1; i++) {
             String temp = S.substring(i-1, i-1+T.length());
             int count = 0;
             for (int j=1; j<=T.length(); j++) {
                if(!temp.substring(j-1,j).equals(T.substring(j-1,j))){
                    count ++;
                }
             };  
             
             ans = Math.min(ans, count);
        }

        System.out.println(ans);
 
    }
    
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
}
