import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String T = sc.next();
    String S = sc.next();
    String[] oT = new String[T.length()-S.length()+1];
    for(int i = 0;i<oT.length;i++){
      oT[i] = T.substring(i,i+S.length());
    }
    int max = 0;
    for(int i = 0;i<oT.length;i++){
      int SM=0;
      for(int j = 0;j<S.length();j++){
        if(S.charAt(j)==oT[i].charAt(j)){
          SM++;
        }
      }
      if(SM>max){
        max = SM;
      }
    }
    System.out.println(S.length()-max);
  }
} import java.util.*; util.* java class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String T = sc.next();
    String S = sc.next();
    String[] oT = new String[T.length()-S.length()+1];
    for(int i = 0;i<oT.length;i++){
      oT[i] = T.substring(i,i+S.length());
    }
    int max = 0;
    for(int i = 0;i<oT.length;i++){
      int SM=0;
      for(int j = 0;j<S.length();j++){
        if(S.charAt(j)==oT[i].charAt(j)){
          SM++;
        }
      }
      if(SM>max){
        max = SM;
      }
    }
    System.out.println(S.length()-max);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String T = sc.next();
    String S = sc.next();
    String[] oT = new String[T.length()-S.length()+1];
    for(int i = 0;i<oT.length;i++){
      oT[i] = T.substring(i,i+S.length());
    }
    int max = 0;
    for(int i = 0;i<oT.length;i++){
      int SM=0;
      for(int j = 0;j<S.length();j++){
        if(S.charAt(j)==oT[i].charAt(j)){
          SM++;
        }
      }
      if(SM>max){
        max = SM;
      }
    }
    System.out.println(S.length()-max);
  } main {
    Scanner sc = new Scanner(System.in);
    String T = sc.next();
    String S = sc.next();
    String[] oT = new String[T.length()-S.length()+1];
    for(int i = 0;i<oT.length;i++){
      oT[i] = T.substring(i,i+S.length());
    }
    int max = 0;
    for(int i = 0;i<oT.length;i++){
      int SM=0;
      for(int j = 0;j<S.length();j++){
        if(S.charAt(j)==oT[i].charAt(j)){
          SM++;
        }
      }
      if(SM>max){
        max = SM;
      }
    }
    System.out.println(S.length()-max);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String T = sc.next(); T sc.next() sc.next sc String S = sc.next(); S sc.next() sc.next sc String[] oT = new String[T.length()-S.length()+1]; oT new String[T.length()-S.length()+1] T.length()-S.length()+1 T.length()-S.length() T.length() T.length T S.length() S.length S 1 for(int i = 0;i<oT.length;i++){
      oT[i] = T.substring(i,i+S.length());
    } int i = 0; int i = 0; i 0 i<oT.length i oT.length oT oT.length i++ i++ i {
      oT[i] = T.substring(i,i+S.length());
    } {
      oT[i] = T.substring(i,i+S.length());
    } oT[i] = T.substring(i,i+S.length()) oT[i] oT i T.substring(i,i+S.length()) T.substring T i i+S.length() i S.length() S.length S int max = 0; max 0 for(int i = 0;i<oT.length;i++){
      int SM=0;
      for(int j = 0;j<S.length();j++){
        if(S.charAt(j)==oT[i].charAt(j)){
          SM++;
        }
      }
      if(SM>max){
        max = SM;
      }
    } int i = 0; int i = 0; i 0 i<oT.length i oT.length oT oT.length i++ i++ i {
      int SM=0;
      for(int j = 0;j<S.length();j++){
        if(S.charAt(j)==oT[i].charAt(j)){
          SM++;
        }
      }
      if(SM>max){
        max = SM;
      }
    } {
      int SM=0;
      for(int j = 0;j<S.length();j++){
        if(S.charAt(j)==oT[i].charAt(j)){
          SM++;
        }
      }
      if(SM>max){
        max = SM;
      }
    } int SM=0; SM 0 for(int j = 0;j<S.length();j++){
        if(S.charAt(j)==oT[i].charAt(j)){
          SM++;
        }
      } int j = 0; int j = 0; j 0 j<S.length() j S.length() S.length S j++ j++ j {
        if(S.charAt(j)==oT[i].charAt(j)){
          SM++;
        }
      } {
        if(S.charAt(j)==oT[i].charAt(j)){
          SM++;
        }
      } if(S.charAt(j)==oT[i].charAt(j)){
          SM++;
        } S.charAt(j)==oT[i].charAt(j) S.charAt(j) S.charAt S j oT[i].charAt(j) oT[i].charAt oT[i] oT i j {
          SM++;
        } SM++ SM if(SM>max){
        max = SM;
      } SM>max SM max {
        max = SM;
      } max = SM max SM System.out.println(S.length()-max) System.out.println System.out System System.out S.length()-max S.length() S.length S max String[] args args
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String T = sc.next();
    String S = sc.next();
    String[] oT = new String[T.length()-S.length()+1];
    for(int i = 0;i<oT.length;i++){
      oT[i] = T.substring(i,i+S.length());
    }
    int max = 0;
    for(int i = 0;i<oT.length;i++){
      int SM=0;
      for(int j = 0;j<S.length();j++){
        if(S.charAt(j)==oT[i].charAt(j)){
          SM++;
        }
      }
      if(SM>max){
        max = SM;
      }
    }
    System.out.println(S.length()-max);
  }
}