import java.util.*;
import java.io.*;



public class Main {

     static PrintWriter p;

     public static void main(String[] args) throws Exception{
        Scanner s= new Scanner(new File("strings.in"));
         p = new PrintWriter(new File("strings.out"));

         String a = s.next();
         s.nextLine();
         String b = s.next();


         int la = a.length();
         int lb = b.length();
         int min = lb;
         for(int i = 0; i < lb-la+1;i++){
             int t = dif(a, b.substring(i,i+la));
             if(t < min ) min = min = t;
         }


         p.println(min);
         p.close();


}
    static int dif(String a, String b){
        int d =0;
        for(int i = 0; i < a.length(); i++){
            if (a.charAt(i)!=b.charAt(i))d++;
        }
        return(d);
    }

}


