import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    String T = sc.nextLine();
    String S = sc.nextLine();
    
    int count = 0;
    int store = S.length();
    
    for(int i = 0; i<=T.length()-S.length();i++){
      count = 0;
      for(int j = 0;j<S.length();j++){
      	if(S.charAt(j)!=T.charAt(i+j)){
        	count++;
      	}
      }
      if (store>=count) store = count; 
    }
    System.out.println(store);
  }
}
       import java.util.Scanner; Scanner java.util public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    String T = sc.nextLine();
    String S = sc.nextLine();
    
    int count = 0;
    int store = S.length();
    
    for(int i = 0; i<=T.length()-S.length();i++){
      count = 0;
      for(int j = 0;j<S.length();j++){
      	if(S.charAt(j)!=T.charAt(i+j)){
        	count++;
      	}
      }
      if (store>=count) store = count; 
    }
    System.out.println(store);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    String T = sc.nextLine();
    String S = sc.nextLine();
    
    int count = 0;
    int store = S.length();
    
    for(int i = 0; i<=T.length()-S.length();i++){
      count = 0;
      for(int j = 0;j<S.length();j++){
      	if(S.charAt(j)!=T.charAt(i+j)){
        	count++;
      	}
      }
      if (store>=count) store = count; 
    }
    System.out.println(store);
  } main {
    Scanner sc = new Scanner(System.in);
    
    String T = sc.nextLine();
    String S = sc.nextLine();
    
    int count = 0;
    int store = S.length();
    
    for(int i = 0; i<=T.length()-S.length();i++){
      count = 0;
      for(int j = 0;j<S.length();j++){
      	if(S.charAt(j)!=T.charAt(i+j)){
        	count++;
      	}
      }
      if (store>=count) store = count; 
    }
    System.out.println(store);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String T = sc.nextLine(); T sc.nextLine() sc.nextLine sc String S = sc.nextLine(); S sc.nextLine() sc.nextLine sc int count = 0; count 0 int store = S.length(); store S.length() S.length S for(int i = 0; i<=T.length()-S.length();i++){
      count = 0;
      for(int j = 0;j<S.length();j++){
      	if(S.charAt(j)!=T.charAt(i+j)){
        	count++;
      	}
      }
      if (store>=count) store = count; 
    } int i = 0; int i = 0; i 0 i<=T.length()-S.length() i T.length()-S.length() T.length() T.length T S.length() S.length S i++ i++ i {
      count = 0;
      for(int j = 0;j<S.length();j++){
      	if(S.charAt(j)!=T.charAt(i+j)){
        	count++;
      	}
      }
      if (store>=count) store = count; 
    } {
      count = 0;
      for(int j = 0;j<S.length();j++){
      	if(S.charAt(j)!=T.charAt(i+j)){
        	count++;
      	}
      }
      if (store>=count) store = count; 
    } count = 0 count 0 for(int j = 0;j<S.length();j++){
      	if(S.charAt(j)!=T.charAt(i+j)){
        	count++;
      	}
      } int j = 0; int j = 0; j 0 j<S.length() j S.length() S.length S j++ j++ j {
      	if(S.charAt(j)!=T.charAt(i+j)){
        	count++;
      	}
      } {
      	if(S.charAt(j)!=T.charAt(i+j)){
        	count++;
      	}
      } if(S.charAt(j)!=T.charAt(i+j)){
        	count++;
      	} S.charAt(j)!=T.charAt(i+j) S.charAt(j) S.charAt S j T.charAt(i+j) T.charAt T i+j i j {
        	count++;
      	} count++ count if (store>=count) store = count; store>=count store count store = count store count System.out.println(store) System.out.println System.out System System.out store String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    String T = sc.nextLine();
    String S = sc.nextLine();
    
    int count = 0;
    int store = S.length();
    
    for(int i = 0; i<=T.length()-S.length();i++){
      count = 0;
      for(int j = 0;j<S.length();j++){
      	if(S.charAt(j)!=T.charAt(i+j)){
        	count++;
      	}
      }
      if (store>=count) store = count; 
    }
    System.out.println(store);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    String T = sc.nextLine();
    String S = sc.nextLine();
    
    int count = 0;
    int store = S.length();
    
    for(int i = 0; i<=T.length()-S.length();i++){
      count = 0;
      for(int j = 0;j<S.length();j++){
      	if(S.charAt(j)!=T.charAt(i+j)){
        	count++;
      	}
      }
      if (store>=count) store = count; 
    }
    System.out.println(store);
  }
} Main
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    String T = sc.nextLine();
    String S = sc.nextLine();
    
    int count = 0;
    int store = S.length();
    
    for(int i = 0; i<=T.length()-S.length();i++){
      count = 0;
      for(int j = 0;j<S.length();j++){
      	if(S.charAt(j)!=T.charAt(i+j)){
        	count++;
      	}
      }
      if (store>=count) store = count; 
    }
    System.out.println(store);
  }
}
      