import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        int slen = s.length;
        char[] t = sc.next().toCharArray();
        int tlen = t.length;
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < slen-tlen+1; i++) {
            int cnt = 0;
            for (int j = 0; j < tlen; j++) {
                if(s[i+j] != t[j]) cnt++;
            }
            if(cnt < ans) ans = cnt;
        }
        System.out.println(ans);
        sc.close();

    }

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

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        int slen = s.length;
        char[] t = sc.next().toCharArray();
        int tlen = t.length;
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < slen-tlen+1; i++) {
            int cnt = 0;
            for (int j = 0; j < tlen; j++) {
                if(s[i+j] != t[j]) cnt++;
            }
            if(cnt < ans) ans = cnt;
        }
        System.out.println(ans);
        sc.close();

    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        int slen = s.length;
        char[] t = sc.next().toCharArray();
        int tlen = t.length;
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < slen-tlen+1; i++) {
            int cnt = 0;
            for (int j = 0; j < tlen; j++) {
                if(s[i+j] != t[j]) cnt++;
            }
            if(cnt < ans) ans = cnt;
        }
        System.out.println(ans);
        sc.close();

    } main {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        int slen = s.length;
        char[] t = sc.next().toCharArray();
        int tlen = t.length;
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < slen-tlen+1; i++) {
            int cnt = 0;
            for (int j = 0; j < tlen; j++) {
                if(s[i+j] != t[j]) cnt++;
            }
            if(cnt < ans) ans = cnt;
        }
        System.out.println(ans);
        sc.close();

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] s = sc.next().toCharArray(); s sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc int slen = s.length; slen s.length s s.length char[] t = sc.next().toCharArray(); t sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc int tlen = t.length; tlen t.length t t.length int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = 0; i < slen-tlen+1; i++) {
            int cnt = 0;
            for (int j = 0; j < tlen; j++) {
                if(s[i+j] != t[j]) cnt++;
            }
            if(cnt < ans) ans = cnt;
        } int i = 0; int i = 0; i 0 i < slen-tlen+1 i slen-tlen+1 slen-tlen slen tlen 1 i++ i++ i {
            int cnt = 0;
            for (int j = 0; j < tlen; j++) {
                if(s[i+j] != t[j]) cnt++;
            }
            if(cnt < ans) ans = cnt;
        } {
            int cnt = 0;
            for (int j = 0; j < tlen; j++) {
                if(s[i+j] != t[j]) cnt++;
            }
            if(cnt < ans) ans = cnt;
        } int cnt = 0; cnt 0 for (int j = 0; j < tlen; j++) {
                if(s[i+j] != t[j]) cnt++;
            } int j = 0; int j = 0; j 0 j < tlen j tlen j++ j++ j {
                if(s[i+j] != t[j]) cnt++;
            } {
                if(s[i+j] != t[j]) cnt++;
            } if(s[i+j] != t[j]) cnt++; s[i+j] != t[j] s[i+j] s i+j i j t[j] t j cnt++ cnt if(cnt < ans) ans = cnt; cnt < ans cnt ans ans = cnt ans cnt System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        int slen = s.length;
        char[] t = sc.next().toCharArray();
        int tlen = t.length;
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < slen-tlen+1; i++) {
            int cnt = 0;
            for (int j = 0; j < tlen; j++) {
                if(s[i+j] != t[j]) cnt++;
            }
            if(cnt < ans) ans = cnt;
        }
        System.out.println(ans);
        sc.close();

    }

} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        int slen = s.length;
        char[] t = sc.next().toCharArray();
        int tlen = t.length;
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < slen-tlen+1; i++) {
            int cnt = 0;
            for (int j = 0; j < tlen; j++) {
                if(s[i+j] != t[j]) cnt++;
            }
            if(cnt < ans) ans = cnt;
        }
        System.out.println(ans);
        sc.close();

    }

} Main
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        int slen = s.length;
        char[] t = sc.next().toCharArray();
        int tlen = t.length;
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < slen-tlen+1; i++) {
            int cnt = 0;
            for (int j = 0; j < tlen; j++) {
                if(s[i+j] != t[j]) cnt++;
            }
            if(cnt < ans) ans = cnt;
        }
        System.out.println(ans);
        sc.close();

    }

}
