import 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();
    //SとTの長さsl tl
    int sl = S.length();
    int tl = T.length();
    //一致していない文字数を数えmに格納。missよりmが小さければmissを更新する
    int miss = 1000;
    int m = 0;
    
    if(S.contains(T)){
      miss = 0;
    }else{
        for(int i = 0; i <= sl - tl; i++){
            for(int j = 0; j < tl; j++){
                if((S.substring(i + j, i + j + 1)).equals(T.substring(j, j + 1)) == false){
                    m += 1;
                }
            }
            if(miss > m){
                miss = m;
            }
            m = 0;
        }
    }
    System.out.println(miss);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.nextLine();
    String T = sc.nextLine();
    //SとTの長さsl tl
    int sl = S.length();
    int tl = T.length();
    //一致していない文字数を数えmに格納。missよりmが小さければmissを更新する
    int miss = 1000;
    int m = 0;
    
    if(S.contains(T)){
      miss = 0;
    }else{
        for(int i = 0; i <= sl - tl; i++){
            for(int j = 0; j < tl; j++){
                if((S.substring(i + j, i + j + 1)).equals(T.substring(j, j + 1)) == false){
                    m += 1;
                }
            }
            if(miss > m){
                miss = m;
            }
            m = 0;
        }
    }
    System.out.println(miss);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.nextLine();
    String T = sc.nextLine();
    //SとTの長さsl tl
    int sl = S.length();
    int tl = T.length();
    //一致していない文字数を数えmに格納。missよりmが小さければmissを更新する
    int miss = 1000;
    int m = 0;
    
    if(S.contains(T)){
      miss = 0;
    }else{
        for(int i = 0; i <= sl - tl; i++){
            for(int j = 0; j < tl; j++){
                if((S.substring(i + j, i + j + 1)).equals(T.substring(j, j + 1)) == false){
                    m += 1;
                }
            }
            if(miss > m){
                miss = m;
            }
            m = 0;
        }
    }
    System.out.println(miss);
  } main {
    Scanner sc = new Scanner(System.in);
    String S = sc.nextLine();
    String T = sc.nextLine();
    //SとTの長さsl tl
    int sl = S.length();
    int tl = T.length();
    //一致していない文字数を数えmに格納。missよりmが小さければmissを更新する
    int miss = 1000;
    int m = 0;
    
    if(S.contains(T)){
      miss = 0;
    }else{
        for(int i = 0; i <= sl - tl; i++){
            for(int j = 0; j < tl; j++){
                if((S.substring(i + j, i + j + 1)).equals(T.substring(j, j + 1)) == false){
                    m += 1;
                }
            }
            if(miss > m){
                miss = m;
            }
            m = 0;
        }
    }
    System.out.println(miss);
  } 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 int sl = S.length(); sl S.length() S.length S int tl = T.length(); tl T.length() T.length T int miss = 1000; miss 1000 int m = 0; m 0 if(S.contains(T)){
      miss = 0;
    }else{
        for(int i = 0; i <= sl - tl; i++){
            for(int j = 0; j < tl; j++){
                if((S.substring(i + j, i + j + 1)).equals(T.substring(j, j + 1)) == false){
                    m += 1;
                }
            }
            if(miss > m){
                miss = m;
            }
            m = 0;
        }
    } S.contains(T) S.contains S T {
      miss = 0;
    } miss = 0 miss 0 {
        for(int i = 0; i <= sl - tl; i++){
            for(int j = 0; j < tl; j++){
                if((S.substring(i + j, i + j + 1)).equals(T.substring(j, j + 1)) == false){
                    m += 1;
                }
            }
            if(miss > m){
                miss = m;
            }
            m = 0;
        }
    } for(int i = 0; i <= sl - tl; i++){
            for(int j = 0; j < tl; j++){
                if((S.substring(i + j, i + j + 1)).equals(T.substring(j, j + 1)) == false){
                    m += 1;
                }
            }
            if(miss > m){
                miss = m;
            }
            m = 0;
        } int i = 0; int i = 0; i 0 i <= sl - tl i sl - tl sl tl i++ i++ i {
            for(int j = 0; j < tl; j++){
                if((S.substring(i + j, i + j + 1)).equals(T.substring(j, j + 1)) == false){
                    m += 1;
                }
            }
            if(miss > m){
                miss = m;
            }
            m = 0;
        } {
            for(int j = 0; j < tl; j++){
                if((S.substring(i + j, i + j + 1)).equals(T.substring(j, j + 1)) == false){
                    m += 1;
                }
            }
            if(miss > m){
                miss = m;
            }
            m = 0;
        } for(int j = 0; j < tl; j++){
                if((S.substring(i + j, i + j + 1)).equals(T.substring(j, j + 1)) == false){
                    m += 1;
                }
            } int j = 0; int j = 0; j 0 j < tl j tl j++ j++ j {
                if((S.substring(i + j, i + j + 1)).equals(T.substring(j, j + 1)) == false){
                    m += 1;
                }
            } {
                if((S.substring(i + j, i + j + 1)).equals(T.substring(j, j + 1)) == false){
                    m += 1;
                }
            } if((S.substring(i + j, i + j + 1)).equals(T.substring(j, j + 1)) == false){
                    m += 1;
                } (S.substring(i + j, i + j + 1)).equals(T.substring(j, j + 1)) == false (S.substring(i + j, i + j + 1)).equals(T.substring(j, j + 1)) (S.substring(i + j, i + j + 1)).equals (S.substring(i + j, i + j + 1)) S.substring S i + j i j i + j + 1 i + j + 1 i j 1 T.substring(j, j + 1) T.substring T j j + 1 j 1 false {
                    m += 1;
                } m += 1 m 1 if(miss > m){
                miss = m;
            } miss > m miss m {
                miss = m;
            } miss = m miss m m = 0 m 0 System.out.println(miss) System.out.println System.out System System.out miss 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();
    //SとTの長さsl tl
    int sl = S.length();
    int tl = T.length();
    //一致していない文字数を数えmに格納。missよりmが小さければmissを更新する
    int miss = 1000;
    int m = 0;
    
    if(S.contains(T)){
      miss = 0;
    }else{
        for(int i = 0; i <= sl - tl; i++){
            for(int j = 0; j < tl; j++){
                if((S.substring(i + j, i + j + 1)).equals(T.substring(j, j + 1)) == false){
                    m += 1;
                }
            }
            if(miss > m){
                miss = m;
            }
            m = 0;
        }
    }
    System.out.println(miss);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.nextLine();
    String T = sc.nextLine();
    //SとTの長さsl tl
    int sl = S.length();
    int tl = T.length();
    //一致していない文字数を数えmに格納。missよりmが小さければmissを更新する
    int miss = 1000;
    int m = 0;
    
    if(S.contains(T)){
      miss = 0;
    }else{
        for(int i = 0; i <= sl - tl; i++){
            for(int j = 0; j < tl; j++){
                if((S.substring(i + j, i + j + 1)).equals(T.substring(j, j + 1)) == false){
                    m += 1;
                }
            }
            if(miss > m){
                miss = m;
            }
            m = 0;
        }
    }
    System.out.println(miss);
  }
} Main
import 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();
    //SとTの長さsl tl
    int sl = S.length();
    int tl = T.length();
    //一致していない文字数を数えmに格納。missよりmが小さければmissを更新する
    int miss = 1000;
    int m = 0;
    
    if(S.contains(T)){
      miss = 0;
    }else{
        for(int i = 0; i <= sl - tl; i++){
            for(int j = 0; j < tl; j++){
                if((S.substring(i + j, i + j + 1)).equals(T.substring(j, j + 1)) == false){
                    m += 1;
                }
            }
            if(miss > m){
                miss = m;
            }
            m = 0;
        }
    }
    System.out.println(miss);
  }
}