import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        char[] ss = s.toCharArray();
        char[] ts = t.toCharArray();
        int ans = Integer.MAX_VALUE;
        int limit = ss.length - ts.length;
        for (int i = 0; i <= limit; i++) {
            int count  = 0;
            for (int j = 0; j < ts.length; j++) {
                if(ss[i + j] != ts[j]){
                    count++;
                }
            }
            ans = Math.min(ans,count);
        }
        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        char[] ss = s.toCharArray();
        char[] ts = t.toCharArray();
        int ans = Integer.MAX_VALUE;
        int limit = ss.length - ts.length;
        for (int i = 0; i <= limit; i++) {
            int count  = 0;
            for (int j = 0; j < ts.length; j++) {
                if(ss[i + j] != ts[j]){
                    count++;
                }
            }
            ans = Math.min(ans,count);
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        char[] ss = s.toCharArray();
        char[] ts = t.toCharArray();
        int ans = Integer.MAX_VALUE;
        int limit = ss.length - ts.length;
        for (int i = 0; i <= limit; i++) {
            int count  = 0;
            for (int j = 0; j < ts.length; j++) {
                if(ss[i + j] != ts[j]){
                    count++;
                }
            }
            ans = Math.min(ans,count);
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        char[] ss = s.toCharArray();
        char[] ts = t.toCharArray();
        int ans = Integer.MAX_VALUE;
        int limit = ss.length - ts.length;
        for (int i = 0; i <= limit; i++) {
            int count  = 0;
            for (int j = 0; j < ts.length; j++) {
                if(ss[i + j] != ts[j]){
                    count++;
                }
            }
            ans = Math.min(ans,count);
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc char[] ss = s.toCharArray(); ss s.toCharArray() s.toCharArray s char[] ts = t.toCharArray(); ts t.toCharArray() t.toCharArray t int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE int limit = ss.length - ts.length; limit ss.length - ts.length ss.length ss ss.length ts.length ts ts.length for (int i = 0; i <= limit; i++) {
            int count  = 0;
            for (int j = 0; j < ts.length; j++) {
                if(ss[i + j] != ts[j]){
                    count++;
                }
            }
            ans = Math.min(ans,count);
        } int i = 0; int i = 0; i 0 i <= limit i limit i++ i++ i {
            int count  = 0;
            for (int j = 0; j < ts.length; j++) {
                if(ss[i + j] != ts[j]){
                    count++;
                }
            }
            ans = Math.min(ans,count);
        } {
            int count  = 0;
            for (int j = 0; j < ts.length; j++) {
                if(ss[i + j] != ts[j]){
                    count++;
                }
            }
            ans = Math.min(ans,count);
        } int count  = 0; count 0 for (int j = 0; j < ts.length; j++) {
                if(ss[i + j] != ts[j]){
                    count++;
                }
            } int j = 0; int j = 0; j 0 j < ts.length j ts.length ts ts.length j++ j++ j {
                if(ss[i + j] != ts[j]){
                    count++;
                }
            } {
                if(ss[i + j] != ts[j]){
                    count++;
                }
            } if(ss[i + j] != ts[j]){
                    count++;
                } ss[i + j] != ts[j] ss[i + j] ss i + j i j ts[j] ts j {
                    count++;
                } count++ count ans = Math.min(ans,count) ans Math.min(ans,count) Math.min Math ans count System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        char[] ss = s.toCharArray();
        char[] ts = t.toCharArray();
        int ans = Integer.MAX_VALUE;
        int limit = ss.length - ts.length;
        for (int i = 0; i <= limit; i++) {
            int count  = 0;
            for (int j = 0; j < ts.length; j++) {
                if(ss[i + j] != ts[j]){
                    count++;
                }
            }
            ans = Math.min(ans,count);
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        char[] ss = s.toCharArray();
        char[] ts = t.toCharArray();
        int ans = Integer.MAX_VALUE;
        int limit = ss.length - ts.length;
        for (int i = 0; i <= limit; i++) {
            int count  = 0;
            for (int j = 0; j < ts.length; j++) {
                if(ss[i + j] != ts[j]){
                    count++;
                }
            }
            ans = Math.min(ans,count);
        }
        System.out.println(ans);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        char[] ss = s.toCharArray();
        char[] ts = t.toCharArray();
        int ans = Integer.MAX_VALUE;
        int limit = ss.length - ts.length;
        for (int i = 0; i <= limit; i++) {
            int count  = 0;
            for (int j = 0; j < ts.length; j++) {
                if(ss[i + j] != ts[j]){
                    count++;
                }
            }
            ans = Math.min(ans,count);
        }
        System.out.println(ans);
    }
}
