import java.io.*;
import java.util.*;
 
public class Main {
    static final long MOD = 1000000007L;
    static final int INF = 50000000;
    static final int NINF = -50000000;
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);
        
        String s = sc.next();
        String t = sc.next();
        int ans = INF;
        for (int i = 0; i <= s.length()-t.length(); i++) {
        	int v = 0;
        	for (int j = i; j < i+t.length(); j++) {
        		if (s.charAt(j)!=t.charAt(j-i))
        			v++;
        	}
        	ans = Math.min(ans,v);
        }
        pw.println(ans);
        pw.close();
    }
 
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
 
        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int ni() {
            return Integer.parseInt(next());
        }
 
        long nl() {
            return Long.parseLong(next());
        }
 
        double nd() {
            return Double.parseDouble(next());
        }
 
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
    static final long MOD = 1000000007L;
    static final int INF = 50000000;
    static final int NINF = -50000000;
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);
        
        String s = sc.next();
        String t = sc.next();
        int ans = INF;
        for (int i = 0; i <= s.length()-t.length(); i++) {
        	int v = 0;
        	for (int j = i; j < i+t.length(); j++) {
        		if (s.charAt(j)!=t.charAt(j-i))
        			v++;
        	}
        	ans = Math.min(ans,v);
        }
        pw.println(ans);
        pw.close();
    }
 
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
 
        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int ni() {
            return Integer.parseInt(next());
        }
 
        long nl() {
            return Long.parseLong(next());
        }
 
        double nd() {
            return Double.parseDouble(next());
        }
 
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
} Main static final long MOD = 1000000007L; MOD 1000000007L static final int INF = 50000000; INF 50000000 static final int NINF = -50000000; NINF -50000000 50000000 public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);
        
        String s = sc.next();
        String t = sc.next();
        int ans = INF;
        for (int i = 0; i <= s.length()-t.length(); i++) {
        	int v = 0;
        	for (int j = i; j < i+t.length(); j++) {
        		if (s.charAt(j)!=t.charAt(j-i))
        			v++;
        	}
        	ans = Math.min(ans,v);
        }
        pw.println(ans);
        pw.close();
    } main {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);
        
        String s = sc.next();
        String t = sc.next();
        int ans = INF;
        for (int i = 0; i <= s.length()-t.length(); i++) {
        	int v = 0;
        	for (int j = i; j < i+t.length(); j++) {
        		if (s.charAt(j)!=t.charAt(j-i))
        			v++;
        	}
        	ans = Math.min(ans,v);
        }
        pw.println(ans);
        pw.close();
    } FastScanner sc = new FastScanner(); sc new FastScanner() PrintWriter pw = new PrintWriter(System.out); pw new PrintWriter(System.out) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc int ans = INF; ans INF for (int i = 0; i <= s.length()-t.length(); i++) {
        	int v = 0;
        	for (int j = i; j < i+t.length(); j++) {
        		if (s.charAt(j)!=t.charAt(j-i))
        			v++;
        	}
        	ans = Math.min(ans,v);
        } int i = 0; int i = 0; i 0 i <= s.length()-t.length() i s.length()-t.length() s.length() s.length s t.length() t.length t i++ i++ i {
        	int v = 0;
        	for (int j = i; j < i+t.length(); j++) {
        		if (s.charAt(j)!=t.charAt(j-i))
        			v++;
        	}
        	ans = Math.min(ans,v);
        } {
        	int v = 0;
        	for (int j = i; j < i+t.length(); j++) {
        		if (s.charAt(j)!=t.charAt(j-i))
        			v++;
        	}
        	ans = Math.min(ans,v);
        } int v = 0; v 0 for (int j = i; j < i+t.length(); j++) {
        		if (s.charAt(j)!=t.charAt(j-i))
        			v++;
        	} int j = i; int j = i; j i j < i+t.length() j i+t.length() i t.length() t.length t j++ j++ j {
        		if (s.charAt(j)!=t.charAt(j-i))
        			v++;
        	} {
        		if (s.charAt(j)!=t.charAt(j-i))
        			v++;
        	} if (s.charAt(j)!=t.charAt(j-i))
        			v++; s.charAt(j)!=t.charAt(j-i) s.charAt(j) s.charAt s j t.charAt(j-i) t.charAt t j-i j i v++ v ans = Math.min(ans,v) ans Math.min(ans,v) Math.min Math ans v pw.println(ans) pw.println pw ans pw.close() pw.close pw String[] args args static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
 
        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int ni() {
            return Integer.parseInt(next());
        }
 
        long nl() {
            return Long.parseLong(next());
        }
 
        double nd() {
            return Double.parseDouble(next());
        }
 
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    } FastScanner BufferedReader br; br StringTokenizer st; st public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        } FastScanner {
            br = new BufferedReader(new InputStreamReader(System.in));
        } br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        } next {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        } while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } st == null || !st.hasMoreElements() st == null st null !st.hasMoreElements() st.hasMoreElements() st.hasMoreElements st {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                } IOException e {
                    e.printStackTrace();
                } e.printStackTrace() e.printStackTrace e {
                    st = new StringTokenizer(br.readLine());
                } st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int ni() {
            return Integer.parseInt(next());
        } ni {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nl() {
            return Long.parseLong(next());
        } nl {
            return Long.parseLong(next());
        } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next double nd() {
            return Double.parseDouble(next());
        } nd {
            return Double.parseDouble(next());
        } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        } nextLine {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        } String str = ""; str "" try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } IOException e {
                e.printStackTrace();
            } e.printStackTrace() e.printStackTrace e {
                str = br.readLine();
            } str = br.readLine() str br.readLine() br.readLine br return str; str public class Main {
    static final long MOD = 1000000007L;
    static final int INF = 50000000;
    static final int NINF = -50000000;
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);
        
        String s = sc.next();
        String t = sc.next();
        int ans = INF;
        for (int i = 0; i <= s.length()-t.length(); i++) {
        	int v = 0;
        	for (int j = i; j < i+t.length(); j++) {
        		if (s.charAt(j)!=t.charAt(j-i))
        			v++;
        	}
        	ans = Math.min(ans,v);
        }
        pw.println(ans);
        pw.close();
    }
 
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
 
        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int ni() {
            return Integer.parseInt(next());
        }
 
        long nl() {
            return Long.parseLong(next());
        }
 
        double nd() {
            return Double.parseDouble(next());
        }
 
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
} public class Main {
    static final long MOD = 1000000007L;
    static final int INF = 50000000;
    static final int NINF = -50000000;
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);
        
        String s = sc.next();
        String t = sc.next();
        int ans = INF;
        for (int i = 0; i <= s.length()-t.length(); i++) {
        	int v = 0;
        	for (int j = i; j < i+t.length(); j++) {
        		if (s.charAt(j)!=t.charAt(j-i))
        			v++;
        	}
        	ans = Math.min(ans,v);
        }
        pw.println(ans);
        pw.close();
    }
 
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
 
        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int ni() {
            return Integer.parseInt(next());
        }
 
        long nl() {
            return Long.parseLong(next());
        }
 
        double nd() {
            return Double.parseDouble(next());
        }
 
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
} Main
import java.io.*;
import java.util.*;
 
public class Main {
    static final long MOD = 1000000007L;
    static final int INF = 50000000;
    static final int NINF = -50000000;
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);
        
        String s = sc.next();
        String t = sc.next();
        int ans = INF;
        for (int i = 0; i <= s.length()-t.length(); i++) {
        	int v = 0;
        	for (int j = i; j < i+t.length(); j++) {
        		if (s.charAt(j)!=t.charAt(j-i))
        			v++;
        	}
        	ans = Math.min(ans,v);
        }
        pw.println(ans);
        pw.close();
    }
 
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
 
        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int ni() {
            return Integer.parseInt(next());
        }
 
        long nl() {
            return Long.parseLong(next());
        }
 
        double nd() {
            return Double.parseDouble(next());
        }
 
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}