/**
 * Created by IntelliJ IDEA.
 * User: o_215
 * Date: 21.10.2009
 * Time: 18:46:59
 * To change this template use File | Settings | File Templates.
 */
import java.util.*;
import java.io.*;

public class F {
public static void main(String[] args) throws Exception{
    Scanner in=new Scanner(new File("strings.in"));
    PrintWriter out=new PrintWriter(new File("strings.out"));
    String f=in.nextLine();int m=f.length() ;
    String s=in.nextLine();int n=s.length() ;
    int minDiff=m;
    for(int i=0;i+m<=n;i++){
        String subS=s.substring(i,i+m);//out.println(subS);
        int diff=m;
        for(int j=0;j<m;j++){
            if(f.charAt(j)==subS.charAt(j)){diff--;}
            //out.println(diff);
        }
        if (minDiff>diff){minDiff=diff;}
    }
    out.println(minDiff);
    in.close();
    out.close();
}
}
