import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main
{
    public static void process(int test_number)throws IOException
    {
        char s[] = nln().toCharArray(), t[] = nln().toCharArray();
        int n = s.length, m = t.length;
        int res = 123456, cnt = 0;

        for(int i = 0; i + m - 1 < n; i++){
            cnt = 0;
            for(int j = 0, k = i; j < m && k < n; j++, k++){
                if(s[k] != t[j])
                    cnt++;
            }

            res = Math.min(res, cnt);
        }        

        pn(res);
    }
 
    static final long mod = (long)1e9+7l;
    
    static FastReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc = new FastReader();
 
        long s = System.currentTimeMillis();
        int t = 1;
        //t = ni();
        for(int i = 1; i <= t; i++)
            process(i);
 
        out.flush();
        System.err.println(System.currentTimeMillis()-s+"ms");
    }

    static void trace(Object... o){ System.err.println(Arrays.deepToString(o)); };
    static void pn(Object o){ out.println(o); }
    static void p(Object o){ out.print(o); }
    static int ni()throws IOException{ return Integer.parseInt(sc.next()); }
    static long nl()throws IOException{ return Long.parseLong(sc.next()); }
    static double nd()throws IOException{ return Double.parseDouble(sc.next()); }
    static String nln()throws IOException{ return sc.nextLine(); }
    static long gcd(long a, long b)throws IOException{ return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{ return (b==0)?a:gcd(b,a%b); }
    static int bit(long n)throws IOException{ return (n==0)?0:(1+bit(n&(n-1))); }
    
    static class FastReader{ 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader(){ 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next(){ 
            while (st == null || !st.hasMoreElements()){ 
                try{ st = new StringTokenizer(br.readLine()); } catch (IOException  e){ e.printStackTrace(); } 
            } 
            return st.nextToken(); 
        } 
  
        String nextLine(){ 
            String str = ""; 
            try{ str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } 
            return str; 
        } 
    } 
} import java.util.*; util.* java import java.io.*; io.* java import java.math.*; math.* java public class Main
{
    public static void process(int test_number)throws IOException
    {
        char s[] = nln().toCharArray(), t[] = nln().toCharArray();
        int n = s.length, m = t.length;
        int res = 123456, cnt = 0;

        for(int i = 0; i + m - 1 < n; i++){
            cnt = 0;
            for(int j = 0, k = i; j < m && k < n; j++, k++){
                if(s[k] != t[j])
                    cnt++;
            }

            res = Math.min(res, cnt);
        }        

        pn(res);
    }
 
    static final long mod = (long)1e9+7l;
    
    static FastReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc = new FastReader();
 
        long s = System.currentTimeMillis();
        int t = 1;
        //t = ni();
        for(int i = 1; i <= t; i++)
            process(i);
 
        out.flush();
        System.err.println(System.currentTimeMillis()-s+"ms");
    }

    static void trace(Object... o){ System.err.println(Arrays.deepToString(o)); };
    static void pn(Object o){ out.println(o); }
    static void p(Object o){ out.print(o); }
    static int ni()throws IOException{ return Integer.parseInt(sc.next()); }
    static long nl()throws IOException{ return Long.parseLong(sc.next()); }
    static double nd()throws IOException{ return Double.parseDouble(sc.next()); }
    static String nln()throws IOException{ return sc.nextLine(); }
    static long gcd(long a, long b)throws IOException{ return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{ return (b==0)?a:gcd(b,a%b); }
    static int bit(long n)throws IOException{ return (n==0)?0:(1+bit(n&(n-1))); }
    
    static class FastReader{ 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader(){ 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next(){ 
            while (st == null || !st.hasMoreElements()){ 
                try{ st = new StringTokenizer(br.readLine()); } catch (IOException  e){ e.printStackTrace(); } 
            } 
            return st.nextToken(); 
        } 
  
        String nextLine(){ 
            String str = ""; 
            try{ str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } 
            return str; 
        } 
    } 
} Main static final long mod = (long)1e9+7l; mod (long)1e9+7l (long)1e9 7l static FastReader sc; sc static PrintWriter out; out public static void process(int test_number)throws IOException
    {
        char s[] = nln().toCharArray(), t[] = nln().toCharArray();
        int n = s.length, m = t.length;
        int res = 123456, cnt = 0;

        for(int i = 0; i + m - 1 < n; i++){
            cnt = 0;
            for(int j = 0, k = i; j < m && k < n; j++, k++){
                if(s[k] != t[j])
                    cnt++;
            }

            res = Math.min(res, cnt);
        }        

        pn(res);
    } process {
        char s[] = nln().toCharArray(), t[] = nln().toCharArray();
        int n = s.length, m = t.length;
        int res = 123456, cnt = 0;

        for(int i = 0; i + m - 1 < n; i++){
            cnt = 0;
            for(int j = 0, k = i; j < m && k < n; j++, k++){
                if(s[k] != t[j])
                    cnt++;
            }

            res = Math.min(res, cnt);
        }        

        pn(res);
    } char s[] = nln().toCharArray() s nln().toCharArray() nln().toCharArray nln() nln t[] = nln().toCharArray(); t nln().toCharArray() nln().toCharArray nln() nln int n = s.length n s.length s s.length m = t.length; m t.length t t.length int res = 123456 res 123456 cnt = 0; cnt 0 for(int i = 0; i + m - 1 < n; i++){
            cnt = 0;
            for(int j = 0, k = i; j < m && k < n; j++, k++){
                if(s[k] != t[j])
                    cnt++;
            }

            res = Math.min(res, cnt);
        } int i = 0; int i = 0; i 0 i + m - 1 < n i + m - 1 i + m i m 1 n i++ i++ i {
            cnt = 0;
            for(int j = 0, k = i; j < m && k < n; j++, k++){
                if(s[k] != t[j])
                    cnt++;
            }

            res = Math.min(res, cnt);
        } {
            cnt = 0;
            for(int j = 0, k = i; j < m && k < n; j++, k++){
                if(s[k] != t[j])
                    cnt++;
            }

            res = Math.min(res, cnt);
        } cnt = 0 cnt 0 for(int j = 0, k = i; j < m && k < n; j++, k++){
                if(s[k] != t[j])
                    cnt++;
            } int j = 0, k = i; int j = 0 j 0 k = i; k i j < m && k < n j < m j m k < n k n j++, k++ j++ j k++ k {
                if(s[k] != t[j])
                    cnt++;
            } {
                if(s[k] != t[j])
                    cnt++;
            } if(s[k] != t[j])
                    cnt++; s[k] != t[j] s[k] s k t[j] t j cnt++ cnt res = Math.min(res, cnt) res Math.min(res, cnt) Math.min Math res cnt pn(res) pn res int test_number test_number public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc = new FastReader();
 
        long s = System.currentTimeMillis();
        int t = 1;
        //t = ni();
        for(int i = 1; i <= t; i++)
            process(i);
 
        out.flush();
        System.err.println(System.currentTimeMillis()-s+"ms");
    } main {
        out = new PrintWriter(System.out);
        sc = new FastReader();
 
        long s = System.currentTimeMillis();
        int t = 1;
        //t = ni();
        for(int i = 1; i <= t; i++)
            process(i);
 
        out.flush();
        System.err.println(System.currentTimeMillis()-s+"ms");
    } out = new PrintWriter(System.out) out new PrintWriter(System.out) sc = new FastReader() sc new FastReader() long s = System.currentTimeMillis(); s System.currentTimeMillis() System.currentTimeMillis System int t = 1; t 1 for(int i = 1; i <= t; i++)
            process(i); int i = 1; int i = 1; i 1 i <= t i t i++ i++ i process(i); process(i) process i out.flush() out.flush out System.err.println(System.currentTimeMillis()-s+"ms") System.err.println System.err System System.err System.currentTimeMillis()-s+"ms" System.currentTimeMillis()-s System.currentTimeMillis() System.currentTimeMillis System s "ms" String[]args args static void trace(Object... o){ System.err.println(Arrays.deepToString(o)); } trace { System.err.println(Arrays.deepToString(o)); } System.err.println(Arrays.deepToString(o)) System.err.println System.err System System.err Arrays.deepToString(o) Arrays.deepToString Arrays o Object... o o static void pn(Object o){ out.println(o); } pn { out.println(o); } out.println(o) out.println out o Object o o static void p(Object o){ out.print(o); } p { out.print(o); } out.print(o) out.print out o Object o o static int ni()throws IOException{ return Integer.parseInt(sc.next()); } ni { return Integer.parseInt(sc.next()); } return Integer.parseInt(sc.next()); Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc static long nl()throws IOException{ return Long.parseLong(sc.next()); } nl { return Long.parseLong(sc.next()); } return Long.parseLong(sc.next()); Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc static double nd()throws IOException{ return Double.parseDouble(sc.next()); } nd { return Double.parseDouble(sc.next()); } return Double.parseDouble(sc.next()); Double.parseDouble(sc.next()) Double.parseDouble Double sc.next() sc.next sc static String nln()throws IOException{ return sc.nextLine(); } nln { return sc.nextLine(); } return sc.nextLine(); sc.nextLine() sc.nextLine sc static long gcd(long a, long b)throws IOException{ return (b==0)?a:gcd(b,a%b);} gcd { return (b==0)?a:gcd(b,a%b);} return (b==0)?a:gcd(b,a%b); (b==0)?a:gcd(b,a%b) (b==0) b 0 a gcd(b,a%b) gcd b a%b a b long a a long b b static int gcd(int a, int b)throws IOException{ return (b==0)?a:gcd(b,a%b); } gcd { return (b==0)?a:gcd(b,a%b); } return (b==0)?a:gcd(b,a%b); (b==0)?a:gcd(b,a%b) (b==0) b 0 a gcd(b,a%b) gcd b a%b a b int a a int b b static int bit(long n)throws IOException{ return (n==0)?0:(1+bit(n&(n-1))); } bit { return (n==0)?0:(1+bit(n&(n-1))); } return (n==0)?0:(1+bit(n&(n-1))); (n==0)?0:(1+bit(n&(n-1))) (n==0) n 0 0 (1+bit(n&(n-1))) 1 bit(n&(n-1)) bit n&(n-1) n (n-1) n 1 long n n static class FastReader{ 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader(){ 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next(){ 
            while (st == null || !st.hasMoreElements()){ 
                try{ st = new StringTokenizer(br.readLine()); } catch (IOException  e){ e.printStackTrace(); } 
            } 
            return st.nextToken(); 
        } 
  
        String nextLine(){ 
            String str = ""; 
            try{ str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } 
            return str; 
        } 
    } FastReader BufferedReader br; br StringTokenizer st; st public FastReader(){ 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } FastReader { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) String next(){ 
            while (st == null || !st.hasMoreElements()){ 
                try{ st = new StringTokenizer(br.readLine()); } catch (IOException  e){ e.printStackTrace(); } 
            } 
            return st.nextToken(); 
        } next { 
            while (st == null || !st.hasMoreElements()){ 
                try{ st = new StringTokenizer(br.readLine()); } catch (IOException  e){ e.printStackTrace(); } 
            } 
            return st.nextToken(); 
        } while (st == null || !st.hasMoreElements()){ 
                try{ st = new StringTokenizer(br.readLine()); } catch (IOException  e){ e.printStackTrace(); } 
            } st == null || !st.hasMoreElements() st == null st null !st.hasMoreElements() st.hasMoreElements() st.hasMoreElements st { 
                try{ st = new StringTokenizer(br.readLine()); } catch (IOException  e){ e.printStackTrace(); } 
            } try{ st = new StringTokenizer(br.readLine()); } catch (IOException  e){ e.printStackTrace(); } catch (IOException  e){ e.printStackTrace(); } IOException  e { e.printStackTrace(); } e.printStackTrace() e.printStackTrace e { st = new StringTokenizer(br.readLine()); } st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st String nextLine(){ 
            String str = ""; 
            try{ str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } 
            return str; 
        } nextLine { 
            String str = ""; 
            try{ str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } 
            return str; 
        } String str = ""; str "" try{ str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } IOException e { e.printStackTrace(); } e.printStackTrace() e.printStackTrace e { str = br.readLine(); } str = br.readLine() str br.readLine() br.readLine br return str; str public class Main
{
    public static void process(int test_number)throws IOException
    {
        char s[] = nln().toCharArray(), t[] = nln().toCharArray();
        int n = s.length, m = t.length;
        int res = 123456, cnt = 0;

        for(int i = 0; i + m - 1 < n; i++){
            cnt = 0;
            for(int j = 0, k = i; j < m && k < n; j++, k++){
                if(s[k] != t[j])
                    cnt++;
            }

            res = Math.min(res, cnt);
        }        

        pn(res);
    }
 
    static final long mod = (long)1e9+7l;
    
    static FastReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc = new FastReader();
 
        long s = System.currentTimeMillis();
        int t = 1;
        //t = ni();
        for(int i = 1; i <= t; i++)
            process(i);
 
        out.flush();
        System.err.println(System.currentTimeMillis()-s+"ms");
    }

    static void trace(Object... o){ System.err.println(Arrays.deepToString(o)); };
    static void pn(Object o){ out.println(o); }
    static void p(Object o){ out.print(o); }
    static int ni()throws IOException{ return Integer.parseInt(sc.next()); }
    static long nl()throws IOException{ return Long.parseLong(sc.next()); }
    static double nd()throws IOException{ return Double.parseDouble(sc.next()); }
    static String nln()throws IOException{ return sc.nextLine(); }
    static long gcd(long a, long b)throws IOException{ return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{ return (b==0)?a:gcd(b,a%b); }
    static int bit(long n)throws IOException{ return (n==0)?0:(1+bit(n&(n-1))); }
    
    static class FastReader{ 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader(){ 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next(){ 
            while (st == null || !st.hasMoreElements()){ 
                try{ st = new StringTokenizer(br.readLine()); } catch (IOException  e){ e.printStackTrace(); } 
            } 
            return st.nextToken(); 
        } 
  
        String nextLine(){ 
            String str = ""; 
            try{ str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } 
            return str; 
        } 
    } 
} public class Main
{
    public static void process(int test_number)throws IOException
    {
        char s[] = nln().toCharArray(), t[] = nln().toCharArray();
        int n = s.length, m = t.length;
        int res = 123456, cnt = 0;

        for(int i = 0; i + m - 1 < n; i++){
            cnt = 0;
            for(int j = 0, k = i; j < m && k < n; j++, k++){
                if(s[k] != t[j])
                    cnt++;
            }

            res = Math.min(res, cnt);
        }        

        pn(res);
    }
 
    static final long mod = (long)1e9+7l;
    
    static FastReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc = new FastReader();
 
        long s = System.currentTimeMillis();
        int t = 1;
        //t = ni();
        for(int i = 1; i <= t; i++)
            process(i);
 
        out.flush();
        System.err.println(System.currentTimeMillis()-s+"ms");
    }

    static void trace(Object... o){ System.err.println(Arrays.deepToString(o)); };
    static void pn(Object o){ out.println(o); }
    static void p(Object o){ out.print(o); }
    static int ni()throws IOException{ return Integer.parseInt(sc.next()); }
    static long nl()throws IOException{ return Long.parseLong(sc.next()); }
    static double nd()throws IOException{ return Double.parseDouble(sc.next()); }
    static String nln()throws IOException{ return sc.nextLine(); }
    static long gcd(long a, long b)throws IOException{ return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{ return (b==0)?a:gcd(b,a%b); }
    static int bit(long n)throws IOException{ return (n==0)?0:(1+bit(n&(n-1))); }
    
    static class FastReader{ 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader(){ 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next(){ 
            while (st == null || !st.hasMoreElements()){ 
                try{ st = new StringTokenizer(br.readLine()); } catch (IOException  e){ e.printStackTrace(); } 
            } 
            return st.nextToken(); 
        } 
  
        String nextLine(){ 
            String str = ""; 
            try{ str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } 
            return str; 
        } 
    } 
} Main
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main
{
    public static void process(int test_number)throws IOException
    {
        char s[] = nln().toCharArray(), t[] = nln().toCharArray();
        int n = s.length, m = t.length;
        int res = 123456, cnt = 0;

        for(int i = 0; i + m - 1 < n; i++){
            cnt = 0;
            for(int j = 0, k = i; j < m && k < n; j++, k++){
                if(s[k] != t[j])
                    cnt++;
            }

            res = Math.min(res, cnt);
        }        

        pn(res);
    }
 
    static final long mod = (long)1e9+7l;
    
    static FastReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc = new FastReader();
 
        long s = System.currentTimeMillis();
        int t = 1;
        //t = ni();
        for(int i = 1; i <= t; i++)
            process(i);
 
        out.flush();
        System.err.println(System.currentTimeMillis()-s+"ms");
    }

    static void trace(Object... o){ System.err.println(Arrays.deepToString(o)); };
    static void pn(Object o){ out.println(o); }
    static void p(Object o){ out.print(o); }
    static int ni()throws IOException{ return Integer.parseInt(sc.next()); }
    static long nl()throws IOException{ return Long.parseLong(sc.next()); }
    static double nd()throws IOException{ return Double.parseDouble(sc.next()); }
    static String nln()throws IOException{ return sc.nextLine(); }
    static long gcd(long a, long b)throws IOException{ return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{ return (b==0)?a:gcd(b,a%b); }
    static int bit(long n)throws IOException{ return (n==0)?0:(1+bit(n&(n-1))); }
    
    static class FastReader{ 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader(){ 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next(){ 
            while (st == null || !st.hasMoreElements()){ 
                try{ st = new StringTokenizer(br.readLine()); } catch (IOException  e){ e.printStackTrace(); } 
            } 
            return st.nextToken(); 
        } 
  
        String nextLine(){ 
            String str = ""; 
            try{ str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } 
            return str; 
        } 
    } 
}
