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;

  }
}


/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz