import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String t = sc.nextLine();
        sc.close();

        int ans = 0;
        for(int i=0; i<=s.length()-t.length(); i++) {
            int match = 0;
            for(int j=0; j<t.length(); j++) {
                if(s.charAt(i+j) == t.charAt(j)) {
                    match++;
                }
            }
            ans = Math.max(ans,match);
        }
        if(ans != 0) System.out.println(t.length()-ans);
        else System.out.println(t.length());

    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String t = sc.nextLine();
        sc.close();

        int ans = 0;
        for(int i=0; i<=s.length()-t.length(); i++) {
            int match = 0;
            for(int j=0; j<t.length(); j++) {
                if(s.charAt(i+j) == t.charAt(j)) {
                    match++;
                }
            }
            ans = Math.max(ans,match);
        }
        if(ans != 0) System.out.println(t.length()-ans);
        else System.out.println(t.length());

    }
} Main public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String t = sc.nextLine();
        sc.close();

        int ans = 0;
        for(int i=0; i<=s.length()-t.length(); i++) {
            int match = 0;
            for(int j=0; j<t.length(); j++) {
                if(s.charAt(i+j) == t.charAt(j)) {
                    match++;
                }
            }
            ans = Math.max(ans,match);
        }
        if(ans != 0) System.out.println(t.length()-ans);
        else System.out.println(t.length());

    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String t = sc.nextLine();
        sc.close();

        int ans = 0;
        for(int i=0; i<=s.length()-t.length(); i++) {
            int match = 0;
            for(int j=0; j<t.length(); j++) {
                if(s.charAt(i+j) == t.charAt(j)) {
                    match++;
                }
            }
            ans = Math.max(ans,match);
        }
        if(ans != 0) System.out.println(t.length()-ans);
        else System.out.println(t.length());

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String t = sc.nextLine(); t sc.nextLine() sc.nextLine sc sc.close() sc.close sc int ans = 0; ans 0 for(int i=0; i<=s.length()-t.length(); i++) {
            int match = 0;
            for(int j=0; j<t.length(); j++) {
                if(s.charAt(i+j) == t.charAt(j)) {
                    match++;
                }
            }
            ans = Math.max(ans,match);
        } 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 match = 0;
            for(int j=0; j<t.length(); j++) {
                if(s.charAt(i+j) == t.charAt(j)) {
                    match++;
                }
            }
            ans = Math.max(ans,match);
        } {
            int match = 0;
            for(int j=0; j<t.length(); j++) {
                if(s.charAt(i+j) == t.charAt(j)) {
                    match++;
                }
            }
            ans = Math.max(ans,match);
        } int match = 0; match 0 for(int j=0; j<t.length(); j++) {
                if(s.charAt(i+j) == t.charAt(j)) {
                    match++;
                }
            } int j=0; int j=0; j 0 j<t.length() j t.length() t.length t j++ j++ j {
                if(s.charAt(i+j) == t.charAt(j)) {
                    match++;
                }
            } {
                if(s.charAt(i+j) == t.charAt(j)) {
                    match++;
                }
            } if(s.charAt(i+j) == t.charAt(j)) {
                    match++;
                } s.charAt(i+j) == t.charAt(j) s.charAt(i+j) s.charAt s i+j i j t.charAt(j) t.charAt t j {
                    match++;
                } match++ match ans = Math.max(ans,match) ans Math.max(ans,match) Math.max Math ans match if(ans != 0) System.out.println(t.length()-ans);
        else System.out.println(t.length()); ans != 0 ans 0 System.out.println(t.length()-ans) System.out.println System.out System System.out t.length()-ans t.length() t.length t ans System.out.println(t.length()) System.out.println System.out System System.out t.length() t.length t String args[] args public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String t = sc.nextLine();
        sc.close();

        int ans = 0;
        for(int i=0; i<=s.length()-t.length(); i++) {
            int match = 0;
            for(int j=0; j<t.length(); j++) {
                if(s.charAt(i+j) == t.charAt(j)) {
                    match++;
                }
            }
            ans = Math.max(ans,match);
        }
        if(ans != 0) System.out.println(t.length()-ans);
        else System.out.println(t.length());

    }
} public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String t = sc.nextLine();
        sc.close();

        int ans = 0;
        for(int i=0; i<=s.length()-t.length(); i++) {
            int match = 0;
            for(int j=0; j<t.length(); j++) {
                if(s.charAt(i+j) == t.charAt(j)) {
                    match++;
                }
            }
            ans = Math.max(ans,match);
        }
        if(ans != 0) System.out.println(t.length()-ans);
        else System.out.println(t.length());

    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String t = sc.nextLine();
        sc.close();

        int ans = 0;
        for(int i=0; i<=s.length()-t.length(); i++) {
            int match = 0;
            for(int j=0; j<t.length(); j++) {
                if(s.charAt(i+j) == t.charAt(j)) {
                    match++;
                }
            }
            ans = Math.max(ans,match);
        }
        if(ans != 0) System.out.println(t.length()-ans);
        else System.out.println(t.length());

    }
}
