import java.util.*;

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

        int wsize = t.length();
        int mcount = 0;
        for(int i = 0 ; i < s.length() - wsize + 1; i++){
            int temp = 0;
            String k = s.substring(i, wsize + i);
            for(int j = 0 ; j < wsize ; j++){
                if(t.charAt(j) == k.charAt(j)) temp++;
            }
            mcount = Math.max(temp,mcount);
        }

        System.out.println(wsize - mcount);

    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();

        int wsize = t.length();
        int mcount = 0;
        for(int i = 0 ; i < s.length() - wsize + 1; i++){
            int temp = 0;
            String k = s.substring(i, wsize + i);
            for(int j = 0 ; j < wsize ; j++){
                if(t.charAt(j) == k.charAt(j)) temp++;
            }
            mcount = Math.max(temp,mcount);
        }

        System.out.println(wsize - mcount);

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

        int wsize = t.length();
        int mcount = 0;
        for(int i = 0 ; i < s.length() - wsize + 1; i++){
            int temp = 0;
            String k = s.substring(i, wsize + i);
            for(int j = 0 ; j < wsize ; j++){
                if(t.charAt(j) == k.charAt(j)) temp++;
            }
            mcount = Math.max(temp,mcount);
        }

        System.out.println(wsize - mcount);

    } main {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();

        int wsize = t.length();
        int mcount = 0;
        for(int i = 0 ; i < s.length() - wsize + 1; i++){
            int temp = 0;
            String k = s.substring(i, wsize + i);
            for(int j = 0 ; j < wsize ; j++){
                if(t.charAt(j) == k.charAt(j)) temp++;
            }
            mcount = Math.max(temp,mcount);
        }

        System.out.println(wsize - mcount);

    } Scanner in = new Scanner(System.in); in new Scanner(System.in) String s = in.next(); s in.next() in.next in String t = in.next(); t in.next() in.next in int wsize = t.length(); wsize t.length() t.length t int mcount = 0; mcount 0 for(int i = 0 ; i < s.length() - wsize + 1; i++){
            int temp = 0;
            String k = s.substring(i, wsize + i);
            for(int j = 0 ; j < wsize ; j++){
                if(t.charAt(j) == k.charAt(j)) temp++;
            }
            mcount = Math.max(temp,mcount);
        } int i = 0 ; int i = 0 ; i 0 i < s.length() - wsize + 1 i s.length() - wsize + 1 s.length() - wsize s.length() s.length s wsize 1 i++ i++ i {
            int temp = 0;
            String k = s.substring(i, wsize + i);
            for(int j = 0 ; j < wsize ; j++){
                if(t.charAt(j) == k.charAt(j)) temp++;
            }
            mcount = Math.max(temp,mcount);
        } {
            int temp = 0;
            String k = s.substring(i, wsize + i);
            for(int j = 0 ; j < wsize ; j++){
                if(t.charAt(j) == k.charAt(j)) temp++;
            }
            mcount = Math.max(temp,mcount);
        } int temp = 0; temp 0 String k = s.substring(i, wsize + i); k s.substring(i, wsize + i) s.substring s i wsize + i wsize i for(int j = 0 ; j < wsize ; j++){
                if(t.charAt(j) == k.charAt(j)) temp++;
            } int j = 0 ; int j = 0 ; j 0 j < wsize j wsize j++ j++ j {
                if(t.charAt(j) == k.charAt(j)) temp++;
            } {
                if(t.charAt(j) == k.charAt(j)) temp++;
            } if(t.charAt(j) == k.charAt(j)) temp++; t.charAt(j) == k.charAt(j) t.charAt(j) t.charAt t j k.charAt(j) k.charAt k j temp++ temp mcount = Math.max(temp,mcount) mcount Math.max(temp,mcount) Math.max Math temp mcount System.out.println(wsize - mcount) System.out.println System.out System System.out wsize - mcount wsize mcount String[] args args public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();

        int wsize = t.length();
        int mcount = 0;
        for(int i = 0 ; i < s.length() - wsize + 1; i++){
            int temp = 0;
            String k = s.substring(i, wsize + i);
            for(int j = 0 ; j < wsize ; j++){
                if(t.charAt(j) == k.charAt(j)) temp++;
            }
            mcount = Math.max(temp,mcount);
        }

        System.out.println(wsize - mcount);

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

        int wsize = t.length();
        int mcount = 0;
        for(int i = 0 ; i < s.length() - wsize + 1; i++){
            int temp = 0;
            String k = s.substring(i, wsize + i);
            for(int j = 0 ; j < wsize ; j++){
                if(t.charAt(j) == k.charAt(j)) temp++;
            }
            mcount = Math.max(temp,mcount);
        }

        System.out.println(wsize - mcount);

    }
} Main
import java.util.*;

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

        int wsize = t.length();
        int mcount = 0;
        for(int i = 0 ; i < s.length() - wsize + 1; i++){
            int temp = 0;
            String k = s.substring(i, wsize + i);
            for(int j = 0 ; j < wsize ; j++){
                if(t.charAt(j) == k.charAt(j)) temp++;
            }
            mcount = Math.max(temp,mcount);
        }

        System.out.println(wsize - mcount);

    }
}