import java.util.Scanner;

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

	        int count = 0;
	        int ans = 0;

	        for(int i=0;i<s.length()-t.length()+1;i++) {
	        	for(int j=0;j<t.length();j++) {
	        		if(s.charAt(i+j) == t.charAt(j)) {
	        			count++;
	        		}
	        	}
	        	ans = Math.max(ans,count);
        		count = 0;
	        }
	        System.out.println(t.length()-ans);
	    }
}
 import java.util.Scanner; Scanner java.util public class Main {
	 public static void main(String[] args){
	        Scanner scan = new Scanner(System.in);
	        String s = scan.nextLine();
	        String t = scan.nextLine();
	        scan.close();

	        int count = 0;
	        int ans = 0;

	        for(int i=0;i<s.length()-t.length()+1;i++) {
	        	for(int j=0;j<t.length();j++) {
	        		if(s.charAt(i+j) == t.charAt(j)) {
	        			count++;
	        		}
	        	}
	        	ans = Math.max(ans,count);
        		count = 0;
	        }
	        System.out.println(t.length()-ans);
	    }
} Main public static void main(String[] args){
	        Scanner scan = new Scanner(System.in);
	        String s = scan.nextLine();
	        String t = scan.nextLine();
	        scan.close();

	        int count = 0;
	        int ans = 0;

	        for(int i=0;i<s.length()-t.length()+1;i++) {
	        	for(int j=0;j<t.length();j++) {
	        		if(s.charAt(i+j) == t.charAt(j)) {
	        			count++;
	        		}
	        	}
	        	ans = Math.max(ans,count);
        		count = 0;
	        }
	        System.out.println(t.length()-ans);
	    } main {
	        Scanner scan = new Scanner(System.in);
	        String s = scan.nextLine();
	        String t = scan.nextLine();
	        scan.close();

	        int count = 0;
	        int ans = 0;

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

	        int count = 0;
	        int ans = 0;

	        for(int i=0;i<s.length()-t.length()+1;i++) {
	        	for(int j=0;j<t.length();j++) {
	        		if(s.charAt(i+j) == t.charAt(j)) {
	        			count++;
	        		}
	        	}
	        	ans = Math.max(ans,count);
        		count = 0;
	        }
	        System.out.println(t.length()-ans);
	    }
} public class Main {
	 public static void main(String[] args){
	        Scanner scan = new Scanner(System.in);
	        String s = scan.nextLine();
	        String t = scan.nextLine();
	        scan.close();

	        int count = 0;
	        int ans = 0;

	        for(int i=0;i<s.length()-t.length()+1;i++) {
	        	for(int j=0;j<t.length();j++) {
	        		if(s.charAt(i+j) == t.charAt(j)) {
	        			count++;
	        		}
	        	}
	        	ans = Math.max(ans,count);
        		count = 0;
	        }
	        System.out.println(t.length()-ans);
	    }
} Main
import java.util.Scanner;

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

	        int count = 0;
	        int ans = 0;

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

