import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();
        
        int maxMatch = 0;
        int slen = s.length();
        int tlen = t.length();
        for(int i=0; i+tlen <= slen; i++) {
            String ssub = s.substring(i, i+tlen);
            int match = 0;
            for(int j=0; j<tlen; j++) {
                if(t.charAt(j) == ssub.charAt(j)) {
                    match++;
                }
            }
            maxMatch = Math.max(maxMatch, match);
        }
        System.out.println(tlen - maxMatch);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();
        
        int maxMatch = 0;
        int slen = s.length();
        int tlen = t.length();
        for(int i=0; i+tlen <= slen; i++) {
            String ssub = s.substring(i, i+tlen);
            int match = 0;
            for(int j=0; j<tlen; j++) {
                if(t.charAt(j) == ssub.charAt(j)) {
                    match++;
                }
            }
            maxMatch = Math.max(maxMatch, match);
        }
        System.out.println(tlen - maxMatch);
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();
        
        int maxMatch = 0;
        int slen = s.length();
        int tlen = t.length();
        for(int i=0; i+tlen <= slen; i++) {
            String ssub = s.substring(i, i+tlen);
            int match = 0;
            for(int j=0; j<tlen; j++) {
                if(t.charAt(j) == ssub.charAt(j)) {
                    match++;
                }
            }
            maxMatch = Math.max(maxMatch, match);
        }
        System.out.println(tlen - maxMatch);
    } main {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();
        
        int maxMatch = 0;
        int slen = s.length();
        int tlen = t.length();
        for(int i=0; i+tlen <= slen; i++) {
            String ssub = s.substring(i, i+tlen);
            int match = 0;
            for(int j=0; j<tlen; j++) {
                if(t.charAt(j) == ssub.charAt(j)) {
                    match++;
                }
            }
            maxMatch = Math.max(maxMatch, match);
        }
        System.out.println(tlen - maxMatch);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) String s = in.next(); s in.next() in.next in String t = in.next(); t in.next() in.next in int maxMatch = 0; maxMatch 0 int slen = s.length(); slen s.length() s.length s int tlen = t.length(); tlen t.length() t.length t for(int i=0; i+tlen <= slen; i++) {
            String ssub = s.substring(i, i+tlen);
            int match = 0;
            for(int j=0; j<tlen; j++) {
                if(t.charAt(j) == ssub.charAt(j)) {
                    match++;
                }
            }
            maxMatch = Math.max(maxMatch, match);
        } int i=0; int i=0; i 0 i+tlen <= slen i+tlen i tlen slen i++ i++ i {
            String ssub = s.substring(i, i+tlen);
            int match = 0;
            for(int j=0; j<tlen; j++) {
                if(t.charAt(j) == ssub.charAt(j)) {
                    match++;
                }
            }
            maxMatch = Math.max(maxMatch, match);
        } {
            String ssub = s.substring(i, i+tlen);
            int match = 0;
            for(int j=0; j<tlen; j++) {
                if(t.charAt(j) == ssub.charAt(j)) {
                    match++;
                }
            }
            maxMatch = Math.max(maxMatch, match);
        } String ssub = s.substring(i, i+tlen); ssub s.substring(i, i+tlen) s.substring s i i+tlen i tlen int match = 0; match 0 for(int j=0; j<tlen; j++) {
                if(t.charAt(j) == ssub.charAt(j)) {
                    match++;
                }
            } int j=0; int j=0; j 0 j<tlen j tlen j++ j++ j {
                if(t.charAt(j) == ssub.charAt(j)) {
                    match++;
                }
            } {
                if(t.charAt(j) == ssub.charAt(j)) {
                    match++;
                }
            } if(t.charAt(j) == ssub.charAt(j)) {
                    match++;
                } t.charAt(j) == ssub.charAt(j) t.charAt(j) t.charAt t j ssub.charAt(j) ssub.charAt ssub j {
                    match++;
                } match++ match maxMatch = Math.max(maxMatch, match) maxMatch Math.max(maxMatch, match) Math.max Math maxMatch match System.out.println(tlen - maxMatch) System.out.println System.out System System.out tlen - maxMatch tlen maxMatch String[] args args public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();
        
        int maxMatch = 0;
        int slen = s.length();
        int tlen = t.length();
        for(int i=0; i+tlen <= slen; i++) {
            String ssub = s.substring(i, i+tlen);
            int match = 0;
            for(int j=0; j<tlen; j++) {
                if(t.charAt(j) == ssub.charAt(j)) {
                    match++;
                }
            }
            maxMatch = Math.max(maxMatch, match);
        }
        System.out.println(tlen - maxMatch);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();
        
        int maxMatch = 0;
        int slen = s.length();
        int tlen = t.length();
        for(int i=0; i+tlen <= slen; i++) {
            String ssub = s.substring(i, i+tlen);
            int match = 0;
            for(int j=0; j<tlen; j++) {
                if(t.charAt(j) == ssub.charAt(j)) {
                    match++;
                }
            }
            maxMatch = Math.max(maxMatch, match);
        }
        System.out.println(tlen - maxMatch);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();
        
        int maxMatch = 0;
        int slen = s.length();
        int tlen = t.length();
        for(int i=0; i+tlen <= slen; i++) {
            String ssub = s.substring(i, i+tlen);
            int match = 0;
            for(int j=0; j<tlen; j++) {
                if(t.charAt(j) == ssub.charAt(j)) {
                    match++;
                }
            }
            maxMatch = Math.max(maxMatch, match);
        }
        System.out.println(tlen - maxMatch);
    }
}
