import java.util.*;

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

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