import 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();
      
      // 一致する文字数の最大値を取得
      int max = 0;
      int lenS = S.length();
      int lenT = T.length();
      for(int i = 0; i < lenS-lenT+1; i++){
        String subS = S.substring(i, i+lenT);
        int count = matchStr(subS, T);
        if(count > max){
          max = count;
        }
      }
      
      // 出力
      System.out.println(lenT - max);
    }
    
    // 2つの文字列の一致する文字数を数える関数
    public static int matchStr(String str1, String str2){
      int len = str1.length();
      int count = 0;
      for(int i = 0; i < len; i++){
        if(str1.charAt(i) == str2.charAt(i)){
          count++;
        }
      }
      return count;
    }

}
/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