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

public class Main
{
	PrintWriter out = new PrintWriter(System.out);
	BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tok = new StringTokenizer("");
    String next() throws IOException {
        if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }
        return tok.nextToken();
    }
    int ni() throws IOException { return Integer.parseInt(next()); }
    long nl() throws IOException { return Long.parseLong(next()); }
    
    void solve() throws IOException {
        String s=next();
        String t=next();
        int ans=Integer.MAX_VALUE;
        for (int i=0;i<=s.length()-t.length();i++) {
            int na=0;
            for (int j=0;j<t.length();j++) {
                if (s.charAt(i+j)!=t.charAt(j)) na++;
            }
            //System.out.println(i+" "+na);
            ans=Math.min(ans,na);
        }
        //out.flush();
        System.out.println(ans);
    }
    
    public static void main(String[] args) throws IOException {
        new Main().solve();
    }
} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java public class Main
{
	PrintWriter out = new PrintWriter(System.out);
	BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tok = new StringTokenizer("");
    String next() throws IOException {
        if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }
        return tok.nextToken();
    }
    int ni() throws IOException { return Integer.parseInt(next()); }
    long nl() throws IOException { return Long.parseLong(next()); }
    
    void solve() throws IOException {
        String s=next();
        String t=next();
        int ans=Integer.MAX_VALUE;
        for (int i=0;i<=s.length()-t.length();i++) {
            int na=0;
            for (int j=0;j<t.length();j++) {
                if (s.charAt(i+j)!=t.charAt(j)) na++;
            }
            //System.out.println(i+" "+na);
            ans=Math.min(ans,na);
        }
        //out.flush();
        System.out.println(ans);
    }
    
    public static void main(String[] args) throws IOException {
        new Main().solve();
    }
} Main PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) StringTokenizer tok = new StringTokenizer(""); tok new StringTokenizer("") String next() throws IOException {
        if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }
        return tok.nextToken();
    } next {
        if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }
        return tok.nextToken();
    } if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); } !tok.hasMoreTokens() tok.hasMoreTokens() tok.hasMoreTokens tok { tok = new StringTokenizer(in.readLine()); } tok = new StringTokenizer(in.readLine()) tok new StringTokenizer(in.readLine()) return tok.nextToken(); tok.nextToken() tok.nextToken tok int ni() throws IOException { return Integer.parseInt(next()); } ni { return Integer.parseInt(next()); } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nl() throws IOException { return Long.parseLong(next()); } nl { return Long.parseLong(next()); } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next void solve() throws IOException {
        String s=next();
        String t=next();
        int ans=Integer.MAX_VALUE;
        for (int i=0;i<=s.length()-t.length();i++) {
            int na=0;
            for (int j=0;j<t.length();j++) {
                if (s.charAt(i+j)!=t.charAt(j)) na++;
            }
            //System.out.println(i+" "+na);
            ans=Math.min(ans,na);
        }
        //out.flush();
        System.out.println(ans);
    } solve {
        String s=next();
        String t=next();
        int ans=Integer.MAX_VALUE;
        for (int i=0;i<=s.length()-t.length();i++) {
            int na=0;
            for (int j=0;j<t.length();j++) {
                if (s.charAt(i+j)!=t.charAt(j)) na++;
            }
            //System.out.println(i+" "+na);
            ans=Math.min(ans,na);
        }
        //out.flush();
        System.out.println(ans);
    } String s=next(); s next() next String t=next(); t next() next int ans=Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i=0;i<=s.length()-t.length();i++) {
            int na=0;
            for (int j=0;j<t.length();j++) {
                if (s.charAt(i+j)!=t.charAt(j)) na++;
            }
            //System.out.println(i+" "+na);
            ans=Math.min(ans,na);
        } int i=0; int i=0; i 0 i<=s.length()-t.length() i s.length()-t.length() s.length() s.length s t.length() t.length t i++ i++ i {
            int na=0;
            for (int j=0;j<t.length();j++) {
                if (s.charAt(i+j)!=t.charAt(j)) na++;
            }
            //System.out.println(i+" "+na);
            ans=Math.min(ans,na);
        } {
            int na=0;
            for (int j=0;j<t.length();j++) {
                if (s.charAt(i+j)!=t.charAt(j)) na++;
            }
            //System.out.println(i+" "+na);
            ans=Math.min(ans,na);
        } int na=0; na 0 for (int j=0;j<t.length();j++) {
                if (s.charAt(i+j)!=t.charAt(j)) na++;
            } int j=0; int j=0; j 0 j<t.length() j t.length() t.length t j++ j++ j {
                if (s.charAt(i+j)!=t.charAt(j)) na++;
            } {
                if (s.charAt(i+j)!=t.charAt(j)) na++;
            } if (s.charAt(i+j)!=t.charAt(j)) na++; s.charAt(i+j)!=t.charAt(j) s.charAt(i+j) s.charAt s i+j i j t.charAt(j) t.charAt t j na++ na ans=Math.min(ans,na) ans Math.min(ans,na) Math.min Math ans na System.out.println(ans) System.out.println System.out System System.out ans public static void main(String[] args) throws IOException {
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args public class Main
{
	PrintWriter out = new PrintWriter(System.out);
	BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tok = new StringTokenizer("");
    String next() throws IOException {
        if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }
        return tok.nextToken();
    }
    int ni() throws IOException { return Integer.parseInt(next()); }
    long nl() throws IOException { return Long.parseLong(next()); }
    
    void solve() throws IOException {
        String s=next();
        String t=next();
        int ans=Integer.MAX_VALUE;
        for (int i=0;i<=s.length()-t.length();i++) {
            int na=0;
            for (int j=0;j<t.length();j++) {
                if (s.charAt(i+j)!=t.charAt(j)) na++;
            }
            //System.out.println(i+" "+na);
            ans=Math.min(ans,na);
        }
        //out.flush();
        System.out.println(ans);
    }
    
    public static void main(String[] args) throws IOException {
        new Main().solve();
    }
} public class Main
{
	PrintWriter out = new PrintWriter(System.out);
	BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tok = new StringTokenizer("");
    String next() throws IOException {
        if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }
        return tok.nextToken();
    }
    int ni() throws IOException { return Integer.parseInt(next()); }
    long nl() throws IOException { return Long.parseLong(next()); }
    
    void solve() throws IOException {
        String s=next();
        String t=next();
        int ans=Integer.MAX_VALUE;
        for (int i=0;i<=s.length()-t.length();i++) {
            int na=0;
            for (int j=0;j<t.length();j++) {
                if (s.charAt(i+j)!=t.charAt(j)) na++;
            }
            //System.out.println(i+" "+na);
            ans=Math.min(ans,na);
        }
        //out.flush();
        System.out.println(ans);
    }
    
    public static void main(String[] args) throws IOException {
        new Main().solve();
    }
} Main
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
	PrintWriter out = new PrintWriter(System.out);
	BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tok = new StringTokenizer("");
    String next() throws IOException {
        if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }
        return tok.nextToken();
    }
    int ni() throws IOException { return Integer.parseInt(next()); }
    long nl() throws IOException { return Long.parseLong(next()); }
    
    void solve() throws IOException {
        String s=next();
        String t=next();
        int ans=Integer.MAX_VALUE;
        for (int i=0;i<=s.length()-t.length();i++) {
            int na=0;
            for (int j=0;j<t.length();j++) {
                if (s.charAt(i+j)!=t.charAt(j)) na++;
            }
            //System.out.println(i+" "+na);
            ans=Math.min(ans,na);
        }
        //out.flush();
        System.out.println(ans);
    }
    
    public static void main(String[] args) throws IOException {
        new Main().solve();
    }
}