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

public class Main{

static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int int_v (String s1){return Integer.parseInt(s1);}
static long long_v(String s1){return Long.parseLong(s1);}
static int[] int_arr() throws IOException{String[] a=read().split("\\s+");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
static long[] long_arr() throws IOException{String[] a=read().split("\\s+");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;}
static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}
static long Modpow(long a,long p,long m){long res=1;while(p>0){if((p&1)!=0){res=(res*a)%m;}p >>=1;a=(a*a)%m;}return res;}
//......................................@uthor_Alx..............................................
static long mod=(long)1e9+7;

public static void main(String[] args) throws  IOException{
                assign();
                String s=read(),t=read();
                int n=s.length(),m=t.length();
                int[][] dp=new int[n+1][m+1];
                int res=m;
                for(int i=1;i<=n;i++){
                    if(i+m-1>n) continue;
                    int tmp=0;
                    for(int j=i;j<i+m;j++){
                        char c1=s.charAt(j-1),c2=t.charAt(j-i);
                        if(c1!=c2) tmp++;
                    }
                    res=Math.min(res,tmp);
                }
                out.write(res+"");
                out.flush();

    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main{

static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int int_v (String s1){return Integer.parseInt(s1);}
static long long_v(String s1){return Long.parseLong(s1);}
static int[] int_arr() throws IOException{String[] a=read().split("\\s+");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
static long[] long_arr() throws IOException{String[] a=read().split("\\s+");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;}
static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}
static long Modpow(long a,long p,long m){long res=1;while(p>0){if((p&1)!=0){res=(res*a)%m;}p >>=1;a=(a*a)%m;}return res;}
//......................................@uthor_Alx..............................................
static long mod=(long)1e9+7;

public static void main(String[] args) throws  IOException{
                assign();
                String s=read(),t=read();
                int n=s.length(),m=t.length();
                int[][] dp=new int[n+1][m+1];
                int res=m;
                for(int i=1;i<=n;i++){
                    if(i+m-1>n) continue;
                    int tmp=0;
                    for(int j=i;j<i+m;j++){
                        char c1=s.charAt(j-1),c2=t.charAt(j-i);
                        if(c1!=c2) tmp++;
                    }
                    res=Math.min(res,tmp);
                }
                out.write(res+"");
                out.flush();

    }
} Main static BufferedReader s1; s1 static BufferedWriter out; out //......................................@uthor_Alx..............................................
static long mod=(long)1e9+7; mod (long)1e9+7 (long)1e9 7 static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;} read {String line="";while(line.length()==0){line=s1.readLine();continue;}return line;} String line=""; line "" while(line.length()==0){line=s1.readLine();continue;} line.length()==0 line.length() line.length line 0 {line=s1.readLine();continue;} line=s1.readLine() line s1.readLine() s1.readLine s1 continue; return line; line static int int_v (String s1){return Integer.parseInt(s1);} int_v {return Integer.parseInt(s1);} return Integer.parseInt(s1); Integer.parseInt(s1) Integer.parseInt Integer s1 String s1 s1 static long long_v(String s1){return Long.parseLong(s1);} long_v {return Long.parseLong(s1);} return Long.parseLong(s1); Long.parseLong(s1) Long.parseLong Long s1 String s1 s1 static int[] int_arr() throws IOException{String[] a=read().split("\\s+");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;} int_arr {String[] a=read().split("\\s+");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;} String[] a=read().split("\\s+"); a read().split("\\s+") read().split read() read "\\s+" int[] b=new int[a.length]; b new int[a.length] a.length a a.length for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);} int i=0; int i=0; i 0 i<a.length i a.length a a.length i++ i++ i {b[i]=int_v(a[i]);} {b[i]=int_v(a[i]);} b[i]=int_v(a[i]) b[i] b i int_v(a[i]) int_v a[i] a i return b; b static long[] long_arr() throws IOException{String[] a=read().split("\\s+");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;} long_arr {String[] a=read().split("\\s+");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;} String[] a=read().split("\\s+"); a read().split("\\s+") read().split read() read "\\s+" long[] b=new long[a.length]; b new long[a.length] a.length a a.length for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);} int i=0; int i=0; i 0 i<a.length i a.length a a.length i++ i++ i {b[i]=long_v(a[i]);} {b[i]=long_v(a[i]);} b[i]=long_v(a[i]) b[i] b i long_v(a[i]) long_v a[i] a i return b; b static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));} assign {s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));} s1=new BufferedReader(new InputStreamReader(System.in)) s1 new BufferedReader(new InputStreamReader(System.in)) out=new BufferedWriter(new OutputStreamWriter(System.out)) out new BufferedWriter(new OutputStreamWriter(System.out)) static long Modpow(long a,long p,long m){long res=1;while(p>0){if((p&1)!=0){res=(res*a)%m;}p >>=1;a=(a*a)%m;}return res;} Modpow {long res=1;while(p>0){if((p&1)!=0){res=(res*a)%m;}p >>=1;a=(a*a)%m;}return res;} long res=1; res 1 while(p>0){if((p&1)!=0){res=(res*a)%m;}p >>=1;a=(a*a)%m;} p>0 p 0 {if((p&1)!=0){res=(res*a)%m;}p >>=1;a=(a*a)%m;} if((p&1)!=0){res=(res*a)%m;} (p&1)!=0 (p&1) p 1 0 {res=(res*a)%m;} res=(res*a)%m res (res*a)%m (res*a) res a m p >>=1 p 1 a=(a*a)%m a (a*a)%m (a*a) a a m return res; res long a a long p p long m m public static void main(String[] args) throws  IOException{
                assign();
                String s=read(),t=read();
                int n=s.length(),m=t.length();
                int[][] dp=new int[n+1][m+1];
                int res=m;
                for(int i=1;i<=n;i++){
                    if(i+m-1>n) continue;
                    int tmp=0;
                    for(int j=i;j<i+m;j++){
                        char c1=s.charAt(j-1),c2=t.charAt(j-i);
                        if(c1!=c2) tmp++;
                    }
                    res=Math.min(res,tmp);
                }
                out.write(res+"");
                out.flush();

    } main {
                assign();
                String s=read(),t=read();
                int n=s.length(),m=t.length();
                int[][] dp=new int[n+1][m+1];
                int res=m;
                for(int i=1;i<=n;i++){
                    if(i+m-1>n) continue;
                    int tmp=0;
                    for(int j=i;j<i+m;j++){
                        char c1=s.charAt(j-1),c2=t.charAt(j-i);
                        if(c1!=c2) tmp++;
                    }
                    res=Math.min(res,tmp);
                }
                out.write(res+"");
                out.flush();

    } assign() assign String s=read() s read() read t=read(); t read() read int n=s.length() n s.length() s.length s m=t.length(); m t.length() t.length t int[][] dp=new int[n+1][m+1]; dp new int[n+1][m+1] n+1 n 1 m+1 m 1 int res=m; res m for(int i=1;i<=n;i++){
                    if(i+m-1>n) continue;
                    int tmp=0;
                    for(int j=i;j<i+m;j++){
                        char c1=s.charAt(j-1),c2=t.charAt(j-i);
                        if(c1!=c2) tmp++;
                    }
                    res=Math.min(res,tmp);
                } int i=1; int i=1; i 1 i<=n i n i++ i++ i {
                    if(i+m-1>n) continue;
                    int tmp=0;
                    for(int j=i;j<i+m;j++){
                        char c1=s.charAt(j-1),c2=t.charAt(j-i);
                        if(c1!=c2) tmp++;
                    }
                    res=Math.min(res,tmp);
                } {
                    if(i+m-1>n) continue;
                    int tmp=0;
                    for(int j=i;j<i+m;j++){
                        char c1=s.charAt(j-1),c2=t.charAt(j-i);
                        if(c1!=c2) tmp++;
                    }
                    res=Math.min(res,tmp);
                } if(i+m-1>n) continue; i+m-1>n i+m-1 i+m i m 1 n continue; int tmp=0; tmp 0 for(int j=i;j<i+m;j++){
                        char c1=s.charAt(j-1),c2=t.charAt(j-i);
                        if(c1!=c2) tmp++;
                    } int j=i; int j=i; j i j<i+m j i+m i m j++ j++ j {
                        char c1=s.charAt(j-1),c2=t.charAt(j-i);
                        if(c1!=c2) tmp++;
                    } {
                        char c1=s.charAt(j-1),c2=t.charAt(j-i);
                        if(c1!=c2) tmp++;
                    } char c1=s.charAt(j-1) c1 s.charAt(j-1) s.charAt s j-1 j 1 c2=t.charAt(j-i); c2 t.charAt(j-i) t.charAt t j-i j i if(c1!=c2) tmp++; c1!=c2 c1 c2 tmp++ tmp res=Math.min(res,tmp) res Math.min(res,tmp) Math.min Math res tmp out.write(res+"") out.write out res+"" res "" out.flush() out.flush out String[] args args public class Main{

static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int int_v (String s1){return Integer.parseInt(s1);}
static long long_v(String s1){return Long.parseLong(s1);}
static int[] int_arr() throws IOException{String[] a=read().split("\\s+");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
static long[] long_arr() throws IOException{String[] a=read().split("\\s+");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;}
static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}
static long Modpow(long a,long p,long m){long res=1;while(p>0){if((p&1)!=0){res=(res*a)%m;}p >>=1;a=(a*a)%m;}return res;}
//......................................@uthor_Alx..............................................
static long mod=(long)1e9+7;

public static void main(String[] args) throws  IOException{
                assign();
                String s=read(),t=read();
                int n=s.length(),m=t.length();
                int[][] dp=new int[n+1][m+1];
                int res=m;
                for(int i=1;i<=n;i++){
                    if(i+m-1>n) continue;
                    int tmp=0;
                    for(int j=i;j<i+m;j++){
                        char c1=s.charAt(j-1),c2=t.charAt(j-i);
                        if(c1!=c2) tmp++;
                    }
                    res=Math.min(res,tmp);
                }
                out.write(res+"");
                out.flush();

    }
} public class Main{

static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int int_v (String s1){return Integer.parseInt(s1);}
static long long_v(String s1){return Long.parseLong(s1);}
static int[] int_arr() throws IOException{String[] a=read().split("\\s+");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
static long[] long_arr() throws IOException{String[] a=read().split("\\s+");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;}
static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}
static long Modpow(long a,long p,long m){long res=1;while(p>0){if((p&1)!=0){res=(res*a)%m;}p >>=1;a=(a*a)%m;}return res;}
//......................................@uthor_Alx..............................................
static long mod=(long)1e9+7;

public static void main(String[] args) throws  IOException{
                assign();
                String s=read(),t=read();
                int n=s.length(),m=t.length();
                int[][] dp=new int[n+1][m+1];
                int res=m;
                for(int i=1;i<=n;i++){
                    if(i+m-1>n) continue;
                    int tmp=0;
                    for(int j=i;j<i+m;j++){
                        char c1=s.charAt(j-1),c2=t.charAt(j-i);
                        if(c1!=c2) tmp++;
                    }
                    res=Math.min(res,tmp);
                }
                out.write(res+"");
                out.flush();

    }
} Main
import java.util.*;
import java.io.*;

public class Main{

static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int int_v (String s1){return Integer.parseInt(s1);}
static long long_v(String s1){return Long.parseLong(s1);}
static int[] int_arr() throws IOException{String[] a=read().split("\\s+");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
static long[] long_arr() throws IOException{String[] a=read().split("\\s+");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;}
static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}
static long Modpow(long a,long p,long m){long res=1;while(p>0){if((p&1)!=0){res=(res*a)%m;}p >>=1;a=(a*a)%m;}return res;}
//......................................@uthor_Alx..............................................
static long mod=(long)1e9+7;

public static void main(String[] args) throws  IOException{
                assign();
                String s=read(),t=read();
                int n=s.length(),m=t.length();
                int[][] dp=new int[n+1][m+1];
                int res=m;
                for(int i=1;i<=n;i++){
                    if(i+m-1>n) continue;
                    int tmp=0;
                    for(int j=i;j<i+m;j++){
                        char c1=s.charAt(j-1),c2=t.charAt(j-i);
                        if(c1!=c2) tmp++;
                    }
                    res=Math.min(res,tmp);
                }
                out.write(res+"");
                out.flush();

    }
}
