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();
        char [] app = new char[S.length()];
        char [] down = new char[T.length()];
        int [] anc = new int[S.length()-T.length()];
        int Min = 0;
        
        
        for(int i = 0;i < S.length();i++){
            app[i] = S.charAt(i);
        }
        for(int i = 0;i < T.length();i++){
            down[i] = T.charAt(i);
        }
        if(S.length() == T.length()){
            int count = 0;
            for(int i = 0;i < T.length();i++){
                if(app[i] != down[i]){
                    count++;
                }
                Min = count;
            }
        System.out.println(Min);
        }else{
            for(int i = 0;i < S.length()-T.length();i++){
                int count = 0;
                for(int l = 0;l < T.length();l++){
                    if(app[i+l] != down[l]){
                        count++;
                    }  
                    anc[i] = count;
                }
            }
            Min = anc[0];
            for(int i = 1 ; i < anc.length; i++){
                if(Min > anc[i]){
                    Min = anc[i];
                    }
                }
                System.out.println(Min);
        }
    }
}

/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