import java.util.Scanner;

public class Main{
    public static Scanner scan  = new Scanner(System.in);
    public static void main(String[]args){
        String s = next();
        String t = next();

        int tmpC = 0;
        int maxC = 0;
        for(int i=0; i<s.length()-t.length()+1; i++){
            for(int j = 0; j<t.length(); j++){
                //print(j);
                //print(i);
                if(s.charAt(i+j) == t.charAt(j)){
                    tmpC += 1;
                }
            }
            //print(maxC);
            maxC = Math.max(tmpC, maxC);
            tmpC = 0;
        }
        print(t.length()-maxC);
    }


    public static int nextInt(){
        return Integer.parseInt(scan.next());
    }
    public static long nextLong(){
        return Long.parseLong(scan.next());
    }
    public static String next(){
        return scan.next();
    }
    public static double nextDouble(){
        return Double.parseDouble(scan.next());
    }
    public static float nextFloat(){
        return Float.parseFloat(scan.next());
    }

    //Yes or No
    public static void yesNo(boolean flag){
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }

    //print
    public static void print(Object a){
        System.out.println(a);
    }


    //gcd
    public static int gcd (int a, int b){
        int tmp;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return b;
    }


    //lcm
    public static int lcm(int a,int b){
        int tmp;
        long c = a;
        c *= b;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return (int)(c/b);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static Scanner scan  = new Scanner(System.in);
    public static void main(String[]args){
        String s = next();
        String t = next();

        int tmpC = 0;
        int maxC = 0;
        for(int i=0; i<s.length()-t.length()+1; i++){
            for(int j = 0; j<t.length(); j++){
                //print(j);
                //print(i);
                if(s.charAt(i+j) == t.charAt(j)){
                    tmpC += 1;
                }
            }
            //print(maxC);
            maxC = Math.max(tmpC, maxC);
            tmpC = 0;
        }
        print(t.length()-maxC);
    }


    public static int nextInt(){
        return Integer.parseInt(scan.next());
    }
    public static long nextLong(){
        return Long.parseLong(scan.next());
    }
    public static String next(){
        return scan.next();
    }
    public static double nextDouble(){
        return Double.parseDouble(scan.next());
    }
    public static float nextFloat(){
        return Float.parseFloat(scan.next());
    }

    //Yes or No
    public static void yesNo(boolean flag){
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }

    //print
    public static void print(Object a){
        System.out.println(a);
    }


    //gcd
    public static int gcd (int a, int b){
        int tmp;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return b;
    }


    //lcm
    public static int lcm(int a,int b){
        int tmp;
        long c = a;
        c *= b;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return (int)(c/b);
    }
} Main public static Scanner scan  = new Scanner(System.in); scan new Scanner(System.in) public static void main(String[]args){
        String s = next();
        String t = next();

        int tmpC = 0;
        int maxC = 0;
        for(int i=0; i<s.length()-t.length()+1; i++){
            for(int j = 0; j<t.length(); j++){
                //print(j);
                //print(i);
                if(s.charAt(i+j) == t.charAt(j)){
                    tmpC += 1;
                }
            }
            //print(maxC);
            maxC = Math.max(tmpC, maxC);
            tmpC = 0;
        }
        print(t.length()-maxC);
    } main {
        String s = next();
        String t = next();

        int tmpC = 0;
        int maxC = 0;
        for(int i=0; i<s.length()-t.length()+1; i++){
            for(int j = 0; j<t.length(); j++){
                //print(j);
                //print(i);
                if(s.charAt(i+j) == t.charAt(j)){
                    tmpC += 1;
                }
            }
            //print(maxC);
            maxC = Math.max(tmpC, maxC);
            tmpC = 0;
        }
        print(t.length()-maxC);
    } String s = next(); s next() next String t = next(); t next() next int tmpC = 0; tmpC 0 int maxC = 0; maxC 0 for(int i=0; i<s.length()-t.length()+1; i++){
            for(int j = 0; j<t.length(); j++){
                //print(j);
                //print(i);
                if(s.charAt(i+j) == t.charAt(j)){
                    tmpC += 1;
                }
            }
            //print(maxC);
            maxC = Math.max(tmpC, maxC);
            tmpC = 0;
        } int i=0; int i=0; i 0 i<s.length()-t.length()+1 i s.length()-t.length()+1 s.length()-t.length() s.length() s.length s t.length() t.length t 1 i++ i++ i {
            for(int j = 0; j<t.length(); j++){
                //print(j);
                //print(i);
                if(s.charAt(i+j) == t.charAt(j)){
                    tmpC += 1;
                }
            }
            //print(maxC);
            maxC = Math.max(tmpC, maxC);
            tmpC = 0;
        } {
            for(int j = 0; j<t.length(); j++){
                //print(j);
                //print(i);
                if(s.charAt(i+j) == t.charAt(j)){
                    tmpC += 1;
                }
            }
            //print(maxC);
            maxC = Math.max(tmpC, maxC);
            tmpC = 0;
        } for(int j = 0; j<t.length(); j++){
                //print(j);
                //print(i);
                if(s.charAt(i+j) == t.charAt(j)){
                    tmpC += 1;
                }
            } int j = 0; int j = 0; j 0 j<t.length() j t.length() t.length t j++ j++ j {
                //print(j);
                //print(i);
                if(s.charAt(i+j) == t.charAt(j)){
                    tmpC += 1;
                }
            } {
                //print(j);
                //print(i);
                if(s.charAt(i+j) == t.charAt(j)){
                    tmpC += 1;
                }
            } if(s.charAt(i+j) == t.charAt(j)){
                    tmpC += 1;
                } 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 {
                    tmpC += 1;
                } tmpC += 1 tmpC 1 maxC = Math.max(tmpC, maxC) maxC Math.max(tmpC, maxC) Math.max Math tmpC maxC tmpC = 0 tmpC 0 print(t.length()-maxC) print t.length()-maxC t.length() t.length t maxC String[]args args public static int nextInt(){
        return Integer.parseInt(scan.next());
    } nextInt {
        return Integer.parseInt(scan.next());
    } return Integer.parseInt(scan.next()); Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan public static long nextLong(){
        return Long.parseLong(scan.next());
    } nextLong {
        return Long.parseLong(scan.next());
    } return Long.parseLong(scan.next()); Long.parseLong(scan.next()) Long.parseLong Long scan.next() scan.next scan public static String next(){
        return scan.next();
    } next {
        return scan.next();
    } return scan.next(); scan.next() scan.next scan public static double nextDouble(){
        return Double.parseDouble(scan.next());
    } nextDouble {
        return Double.parseDouble(scan.next());
    } return Double.parseDouble(scan.next()); Double.parseDouble(scan.next()) Double.parseDouble Double scan.next() scan.next scan public static float nextFloat(){
        return Float.parseFloat(scan.next());
    } nextFloat {
        return Float.parseFloat(scan.next());
    } return Float.parseFloat(scan.next()); Float.parseFloat(scan.next()) Float.parseFloat Float scan.next() scan.next scan //Yes or No
    public static void yesNo(boolean flag){
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    } yesNo {
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    } if(flag) System.out.println("Yes");
        else System.out.println("No"); flag System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" boolean flag flag //print
    public static void print(Object a){
        System.out.println(a);
    } print {
        System.out.println(a);
    } System.out.println(a) System.out.println System.out System System.out a Object a a //gcd
    public static int gcd (int a, int b){
        int tmp;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return b;
    } gcd {
        int tmp;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return b;
    } int tmp; tmp while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        } (tmp = a%b) != 0 (tmp = a%b) tmp a%b a b 0 {
            a = b;
            b = tmp;
        } a = b a b b = tmp b tmp return b; b int a a int b b //lcm
    public static int lcm(int a,int b){
        int tmp;
        long c = a;
        c *= b;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return (int)(c/b);
    } lcm {
        int tmp;
        long c = a;
        c *= b;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return (int)(c/b);
    } int tmp; tmp long c = a; c a c *= b c b while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        } (tmp = a%b) != 0 (tmp = a%b) tmp a%b a b 0 {
            a = b;
            b = tmp;
        } a = b a b b = tmp b tmp return (int)(c/b); (int)(c/b) c b int a a int b b public class Main{
    public static Scanner scan  = new Scanner(System.in);
    public static void main(String[]args){
        String s = next();
        String t = next();

        int tmpC = 0;
        int maxC = 0;
        for(int i=0; i<s.length()-t.length()+1; i++){
            for(int j = 0; j<t.length(); j++){
                //print(j);
                //print(i);
                if(s.charAt(i+j) == t.charAt(j)){
                    tmpC += 1;
                }
            }
            //print(maxC);
            maxC = Math.max(tmpC, maxC);
            tmpC = 0;
        }
        print(t.length()-maxC);
    }


    public static int nextInt(){
        return Integer.parseInt(scan.next());
    }
    public static long nextLong(){
        return Long.parseLong(scan.next());
    }
    public static String next(){
        return scan.next();
    }
    public static double nextDouble(){
        return Double.parseDouble(scan.next());
    }
    public static float nextFloat(){
        return Float.parseFloat(scan.next());
    }

    //Yes or No
    public static void yesNo(boolean flag){
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }

    //print
    public static void print(Object a){
        System.out.println(a);
    }


    //gcd
    public static int gcd (int a, int b){
        int tmp;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return b;
    }


    //lcm
    public static int lcm(int a,int b){
        int tmp;
        long c = a;
        c *= b;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return (int)(c/b);
    }
} public class Main{
    public static Scanner scan  = new Scanner(System.in);
    public static void main(String[]args){
        String s = next();
        String t = next();

        int tmpC = 0;
        int maxC = 0;
        for(int i=0; i<s.length()-t.length()+1; i++){
            for(int j = 0; j<t.length(); j++){
                //print(j);
                //print(i);
                if(s.charAt(i+j) == t.charAt(j)){
                    tmpC += 1;
                }
            }
            //print(maxC);
            maxC = Math.max(tmpC, maxC);
            tmpC = 0;
        }
        print(t.length()-maxC);
    }


    public static int nextInt(){
        return Integer.parseInt(scan.next());
    }
    public static long nextLong(){
        return Long.parseLong(scan.next());
    }
    public static String next(){
        return scan.next();
    }
    public static double nextDouble(){
        return Double.parseDouble(scan.next());
    }
    public static float nextFloat(){
        return Float.parseFloat(scan.next());
    }

    //Yes or No
    public static void yesNo(boolean flag){
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }

    //print
    public static void print(Object a){
        System.out.println(a);
    }


    //gcd
    public static int gcd (int a, int b){
        int tmp;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return b;
    }


    //lcm
    public static int lcm(int a,int b){
        int tmp;
        long c = a;
        c *= b;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return (int)(c/b);
    }
} Main
import java.util.Scanner;

public class Main{
    public static Scanner scan  = new Scanner(System.in);
    public static void main(String[]args){
        String s = next();
        String t = next();

        int tmpC = 0;
        int maxC = 0;
        for(int i=0; i<s.length()-t.length()+1; i++){
            for(int j = 0; j<t.length(); j++){
                //print(j);
                //print(i);
                if(s.charAt(i+j) == t.charAt(j)){
                    tmpC += 1;
                }
            }
            //print(maxC);
            maxC = Math.max(tmpC, maxC);
            tmpC = 0;
        }
        print(t.length()-maxC);
    }


    public static int nextInt(){
        return Integer.parseInt(scan.next());
    }
    public static long nextLong(){
        return Long.parseLong(scan.next());
    }
    public static String next(){
        return scan.next();
    }
    public static double nextDouble(){
        return Double.parseDouble(scan.next());
    }
    public static float nextFloat(){
        return Float.parseFloat(scan.next());
    }

    //Yes or No
    public static void yesNo(boolean flag){
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }

    //print
    public static void print(Object a){
        System.out.println(a);
    }


    //gcd
    public static int gcd (int a, int b){
        int tmp;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return b;
    }


    //lcm
    public static int lcm(int a,int b){
        int tmp;
        long c = a;
        c *= b;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return (int)(c/b);
    }
}