import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    
    String s = sc.nextLine();
    String t = sc.nextLine();

    char[] schar = s.toCharArray();
    char[] tchar = t.toCharArray();

    int[] diff = new int[s.length() - t.length() + 1];

    for(int i=0; i<schar.length - tchar.length + 1; i++){
      for(int j=0; j<tchar.length; j++){
        if(schar[i + j] != tchar[j]){
          diff[i]++;
        }
      }
    }

    int min = 10000;
    for(int i=0; i<diff.length; i++){
      if(min > diff[i]){
        min = diff[i];
      }
    }

    System.out.println(min);

    return;

  }
}
 import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays 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.nextLine();
    String t = sc.nextLine();

    char[] schar = s.toCharArray();
    char[] tchar = t.toCharArray();

    int[] diff = new int[s.length() - t.length() + 1];

    for(int i=0; i<schar.length - tchar.length + 1; i++){
      for(int j=0; j<tchar.length; j++){
        if(schar[i + j] != tchar[j]){
          diff[i]++;
        }
      }
    }

    int min = 10000;
    for(int i=0; i<diff.length; i++){
      if(min > diff[i]){
        min = diff[i];
      }
    }

    System.out.println(min);

    return;

  }
} Main public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    
    String s = sc.nextLine();
    String t = sc.nextLine();

    char[] schar = s.toCharArray();
    char[] tchar = t.toCharArray();

    int[] diff = new int[s.length() - t.length() + 1];

    for(int i=0; i<schar.length - tchar.length + 1; i++){
      for(int j=0; j<tchar.length; j++){
        if(schar[i + j] != tchar[j]){
          diff[i]++;
        }
      }
    }

    int min = 10000;
    for(int i=0; i<diff.length; i++){
      if(min > diff[i]){
        min = diff[i];
      }
    }

    System.out.println(min);

    return;

  } main {

    Scanner sc = new Scanner(System.in);
    
    String s = sc.nextLine();
    String t = sc.nextLine();

    char[] schar = s.toCharArray();
    char[] tchar = t.toCharArray();

    int[] diff = new int[s.length() - t.length() + 1];

    for(int i=0; i<schar.length - tchar.length + 1; i++){
      for(int j=0; j<tchar.length; j++){
        if(schar[i + j] != tchar[j]){
          diff[i]++;
        }
      }
    }

    int min = 10000;
    for(int i=0; i<diff.length; i++){
      if(min > diff[i]){
        min = diff[i];
      }
    }

    System.out.println(min);

    return;

  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String t = sc.nextLine(); t sc.nextLine() sc.nextLine sc char[] schar = s.toCharArray(); schar s.toCharArray() s.toCharArray s char[] tchar = t.toCharArray(); tchar t.toCharArray() t.toCharArray t int[] diff = new int[s.length() - t.length() + 1]; diff new int[s.length() - t.length() + 1] s.length() - t.length() + 1 s.length() - t.length() s.length() s.length s t.length() t.length t 1 for(int i=0; i<schar.length - tchar.length + 1; i++){
      for(int j=0; j<tchar.length; j++){
        if(schar[i + j] != tchar[j]){
          diff[i]++;
        }
      }
    } int i=0; int i=0; i 0 i<schar.length - tchar.length + 1 i schar.length - tchar.length + 1 schar.length - tchar.length schar.length schar schar.length tchar.length tchar tchar.length 1 i++ i++ i {
      for(int j=0; j<tchar.length; j++){
        if(schar[i + j] != tchar[j]){
          diff[i]++;
        }
      }
    } {
      for(int j=0; j<tchar.length; j++){
        if(schar[i + j] != tchar[j]){
          diff[i]++;
        }
      }
    } for(int j=0; j<tchar.length; j++){
        if(schar[i + j] != tchar[j]){
          diff[i]++;
        }
      } int j=0; int j=0; j 0 j<tchar.length j tchar.length tchar tchar.length j++ j++ j {
        if(schar[i + j] != tchar[j]){
          diff[i]++;
        }
      } {
        if(schar[i + j] != tchar[j]){
          diff[i]++;
        }
      } if(schar[i + j] != tchar[j]){
          diff[i]++;
        } schar[i + j] != tchar[j] schar[i + j] schar i + j i j tchar[j] tchar j {
          diff[i]++;
        } diff[i]++ diff[i] diff i int min = 10000; min 10000 for(int i=0; i<diff.length; i++){
      if(min > diff[i]){
        min = diff[i];
      }
    } int i=0; int i=0; i 0 i<diff.length i diff.length diff diff.length i++ i++ i {
      if(min > diff[i]){
        min = diff[i];
      }
    } {
      if(min > diff[i]){
        min = diff[i];
      }
    } if(min > diff[i]){
        min = diff[i];
      } min > diff[i] min diff[i] diff i {
        min = diff[i];
      } min = diff[i] min diff[i] diff i System.out.println(min) System.out.println System.out System System.out min return; String[] args args public class Main {
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    
    String s = sc.nextLine();
    String t = sc.nextLine();

    char[] schar = s.toCharArray();
    char[] tchar = t.toCharArray();

    int[] diff = new int[s.length() - t.length() + 1];

    for(int i=0; i<schar.length - tchar.length + 1; i++){
      for(int j=0; j<tchar.length; j++){
        if(schar[i + j] != tchar[j]){
          diff[i]++;
        }
      }
    }

    int min = 10000;
    for(int i=0; i<diff.length; i++){
      if(min > diff[i]){
        min = diff[i];
      }
    }

    System.out.println(min);

    return;

  }
} public class Main {
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    
    String s = sc.nextLine();
    String t = sc.nextLine();

    char[] schar = s.toCharArray();
    char[] tchar = t.toCharArray();

    int[] diff = new int[s.length() - t.length() + 1];

    for(int i=0; i<schar.length - tchar.length + 1; i++){
      for(int j=0; j<tchar.length; j++){
        if(schar[i + j] != tchar[j]){
          diff[i]++;
        }
      }
    }

    int min = 10000;
    for(int i=0; i<diff.length; i++){
      if(min > diff[i]){
        min = diff[i];
      }
    }

    System.out.println(min);

    return;

  }
} Main
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    
    String s = sc.nextLine();
    String t = sc.nextLine();

    char[] schar = s.toCharArray();
    char[] tchar = t.toCharArray();

    int[] diff = new int[s.length() - t.length() + 1];

    for(int i=0; i<schar.length - tchar.length + 1; i++){
      for(int j=0; j<tchar.length; j++){
        if(schar[i + j] != tchar[j]){
          diff[i]++;
        }
      }
    }

    int min = 10000;
    for(int i=0; i<diff.length; i++){
      if(min > diff[i]){
        min = diff[i];
      }
    }

    System.out.println(min);

    return;

  }
}

