import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String T = sc.next();
    char[]ss = S.toCharArray();
    char[]t = T.toCharArray();
    ArrayList<Integer>ans  = new ArrayList<>();

    for(int i=0; i<=S.length() - T.length(); i++) {
    	int cou = 0;
       	for(int j=0; j< T.length(); j++) {
      		if(ss[i+j] == t[j]) {
    		cou++;
    		}
    	}
    	ans.add(cou);
    	cou = 0;
    }
    Collections.sort(ans,Collections.reverseOrder());
    	System.out.println(T.length() - ans.get(0));
    	
      }
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util 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.next();
    String T = sc.next();
    char[]ss = S.toCharArray();
    char[]t = T.toCharArray();
    ArrayList<Integer>ans  = new ArrayList<>();

    for(int i=0; i<=S.length() - T.length(); i++) {
    	int cou = 0;
       	for(int j=0; j< T.length(); j++) {
      		if(ss[i+j] == t[j]) {
    		cou++;
    		}
    	}
    	ans.add(cou);
    	cou = 0;
    }
    Collections.sort(ans,Collections.reverseOrder());
    	System.out.println(T.length() - ans.get(0));
    	
      }
} Main public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String T = sc.next();
    char[]ss = S.toCharArray();
    char[]t = T.toCharArray();
    ArrayList<Integer>ans  = new ArrayList<>();

    for(int i=0; i<=S.length() - T.length(); i++) {
    	int cou = 0;
       	for(int j=0; j< T.length(); j++) {
      		if(ss[i+j] == t[j]) {
    		cou++;
    		}
    	}
    	ans.add(cou);
    	cou = 0;
    }
    Collections.sort(ans,Collections.reverseOrder());
    	System.out.println(T.length() - ans.get(0));
    	
      } main {
    
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String T = sc.next();
    char[]ss = S.toCharArray();
    char[]t = T.toCharArray();
    ArrayList<Integer>ans  = new ArrayList<>();

    for(int i=0; i<=S.length() - T.length(); i++) {
    	int cou = 0;
       	for(int j=0; j< T.length(); j++) {
      		if(ss[i+j] == t[j]) {
    		cou++;
    		}
    	}
    	ans.add(cou);
    	cou = 0;
    }
    Collections.sort(ans,Collections.reverseOrder());
    	System.out.println(T.length() - ans.get(0));
    	
      } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc char[]ss = S.toCharArray(); ss S.toCharArray() S.toCharArray S char[]t = T.toCharArray(); t T.toCharArray() T.toCharArray T ArrayList<Integer>ans  = new ArrayList<>(); ans new ArrayList<>() for(int i=0; i<=S.length() - T.length(); i++) {
    	int cou = 0;
       	for(int j=0; j< T.length(); j++) {
      		if(ss[i+j] == t[j]) {
    		cou++;
    		}
    	}
    	ans.add(cou);
    	cou = 0;
    } 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 cou = 0;
       	for(int j=0; j< T.length(); j++) {
      		if(ss[i+j] == t[j]) {
    		cou++;
    		}
    	}
    	ans.add(cou);
    	cou = 0;
    } {
    	int cou = 0;
       	for(int j=0; j< T.length(); j++) {
      		if(ss[i+j] == t[j]) {
    		cou++;
    		}
    	}
    	ans.add(cou);
    	cou = 0;
    } int cou = 0; cou 0 for(int j=0; j< T.length(); j++) {
      		if(ss[i+j] == t[j]) {
    		cou++;
    		}
    	} int j=0; int j=0; j 0 j< T.length() j T.length() T.length T j++ j++ j {
      		if(ss[i+j] == t[j]) {
    		cou++;
    		}
    	} {
      		if(ss[i+j] == t[j]) {
    		cou++;
    		}
    	} if(ss[i+j] == t[j]) {
    		cou++;
    		} ss[i+j] == t[j] ss[i+j] ss i+j i j t[j] t j {
    		cou++;
    		} cou++ cou ans.add(cou) ans.add ans cou cou = 0 cou 0 Collections.sort(ans,Collections.reverseOrder()) Collections.sort Collections ans Collections.reverseOrder() Collections.reverseOrder Collections System.out.println(T.length() - ans.get(0)) System.out.println System.out System System.out T.length() - ans.get(0) T.length() T.length T ans.get(0) ans.get ans 0 String[] args args public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String T = sc.next();
    char[]ss = S.toCharArray();
    char[]t = T.toCharArray();
    ArrayList<Integer>ans  = new ArrayList<>();

    for(int i=0; i<=S.length() - T.length(); i++) {
    	int cou = 0;
       	for(int j=0; j< T.length(); j++) {
      		if(ss[i+j] == t[j]) {
    		cou++;
    		}
    	}
    	ans.add(cou);
    	cou = 0;
    }
    Collections.sort(ans,Collections.reverseOrder());
    	System.out.println(T.length() - ans.get(0));
    	
      }
} public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String T = sc.next();
    char[]ss = S.toCharArray();
    char[]t = T.toCharArray();
    ArrayList<Integer>ans  = new ArrayList<>();

    for(int i=0; i<=S.length() - T.length(); i++) {
    	int cou = 0;
       	for(int j=0; j< T.length(); j++) {
      		if(ss[i+j] == t[j]) {
    		cou++;
    		}
    	}
    	ans.add(cou);
    	cou = 0;
    }
    Collections.sort(ans,Collections.reverseOrder());
    	System.out.println(T.length() - ans.get(0));
    	
      }
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String T = sc.next();
    char[]ss = S.toCharArray();
    char[]t = T.toCharArray();
    ArrayList<Integer>ans  = new ArrayList<>();

    for(int i=0; i<=S.length() - T.length(); i++) {
    	int cou = 0;
       	for(int j=0; j< T.length(); j++) {
      		if(ss[i+j] == t[j]) {
    		cou++;
    		}
    	}
    	ans.add(cou);
    	cou = 0;
    }
    Collections.sort(ans,Collections.reverseOrder());
    	System.out.println(T.length() - ans.get(0));
    	
      }
}
