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

} import java.util.*; util.* java 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;
    }

} 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);
    } main {
      // 入力
      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);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc int max = 0; max 0 int lenS = S.length(); lenS S.length() S.length S int lenT = T.length(); lenT T.length() T.length T 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;
        }
      } int i = 0; int i = 0; i 0 i < lenS-lenT+1 i lenS-lenT+1 lenS-lenT lenS lenT 1 i++ i++ i {
        String subS = S.substring(i, i+lenT);
        int count = matchStr(subS, T);
        if(count > max){
          max = count;
        }
      } {
        String subS = S.substring(i, i+lenT);
        int count = matchStr(subS, T);
        if(count > max){
          max = count;
        }
      } String subS = S.substring(i, i+lenT); subS S.substring(i, i+lenT) S.substring S i i+lenT i lenT int count = matchStr(subS, T); count matchStr(subS, T) matchStr subS T if(count > max){
          max = count;
        } count > max count max {
          max = count;
        } max = count max count System.out.println(lenT - max) System.out.println System.out System System.out lenT - max lenT max String[] args args // 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;
    } matchStr {
      int len = str1.length();
      int count = 0;
      for(int i = 0; i < len; i++){
        if(str1.charAt(i) == str2.charAt(i)){
          count++;
        }
      }
      return count;
    } int len = str1.length(); len str1.length() str1.length str1 int count = 0; count 0 for(int i = 0; i < len; i++){
        if(str1.charAt(i) == str2.charAt(i)){
          count++;
        }
      } int i = 0; int i = 0; i 0 i < len i len i++ i++ i {
        if(str1.charAt(i) == str2.charAt(i)){
          count++;
        }
      } {
        if(str1.charAt(i) == str2.charAt(i)){
          count++;
        }
      } if(str1.charAt(i) == str2.charAt(i)){
          count++;
        } str1.charAt(i) == str2.charAt(i) str1.charAt(i) str1.charAt str1 i str2.charAt(i) str2.charAt str2 i {
          count++;
        } count++ count return count; count String str1 str1 String str2 str2 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;
    }

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

} Main
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;
    }

}