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



/**
 * Created by IntelliJ IDEA.
 * User: m09cke
 * Date: 21.10.2009
 * Time: 17:10:40
 * To change this template use File | Settings | File Templates.
 */
public class Main {
    public static void main(String[] args)throws FileNotFoundException{
        Scanner in = new Scanner(new File("strings.in"));
        PrintWriter out = new PrintWriter("strings.out");
        String s=in.next();
        String v=in.next();
        int k=0;
        int m=s.length();
        for (int j=0;j<v.length()-s.length()+1;j++) {
            k=0;
            for (int i=0;i<s.length();i++){
                if (s.charAt(i)!=v.charAt(i+j)) k++;
            }
            
            if (k<m) m=k;
        }
        out.println(m);
        out.close();
    }
}