import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner stdIn = new Scanner(System.in);
		String S = stdIn.nextLine();
		String T = stdIn.nextLine();
		
		char[] s = S.toCharArray();
		char[] t = T.toCharArray();
		
		int minCount = 1000;
		
		for(int i = 0; i <= s.length - t.length; i ++) {
			int counter = 0;
			for(int j = 0; j < t.length; j ++) {
				if(s[i + j] != t[j]) {
					counter ++;
				}
				if(minCount <= counter) {
					break;
				}
			}
			minCount = Math.min(minCount, counter);
		}
		
		System.out.println(minCount);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String args[]) {
		Scanner stdIn = new Scanner(System.in);
		String S = stdIn.nextLine();
		String T = stdIn.nextLine();
		
		char[] s = S.toCharArray();
		char[] t = T.toCharArray();
		
		int minCount = 1000;
		
		for(int i = 0; i <= s.length - t.length; i ++) {
			int counter = 0;
			for(int j = 0; j < t.length; j ++) {
				if(s[i + j] != t[j]) {
					counter ++;
				}
				if(minCount <= counter) {
					break;
				}
			}
			minCount = Math.min(minCount, counter);
		}
		
		System.out.println(minCount);
	}
} Main public static void main(String args[]) {
		Scanner stdIn = new Scanner(System.in);
		String S = stdIn.nextLine();
		String T = stdIn.nextLine();
		
		char[] s = S.toCharArray();
		char[] t = T.toCharArray();
		
		int minCount = 1000;
		
		for(int i = 0; i <= s.length - t.length; i ++) {
			int counter = 0;
			for(int j = 0; j < t.length; j ++) {
				if(s[i + j] != t[j]) {
					counter ++;
				}
				if(minCount <= counter) {
					break;
				}
			}
			minCount = Math.min(minCount, counter);
		}
		
		System.out.println(minCount);
	} main {
		Scanner stdIn = new Scanner(System.in);
		String S = stdIn.nextLine();
		String T = stdIn.nextLine();
		
		char[] s = S.toCharArray();
		char[] t = T.toCharArray();
		
		int minCount = 1000;
		
		for(int i = 0; i <= s.length - t.length; i ++) {
			int counter = 0;
			for(int j = 0; j < t.length; j ++) {
				if(s[i + j] != t[j]) {
					counter ++;
				}
				if(minCount <= counter) {
					break;
				}
			}
			minCount = Math.min(minCount, counter);
		}
		
		System.out.println(minCount);
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) String S = stdIn.nextLine(); S stdIn.nextLine() stdIn.nextLine stdIn String T = stdIn.nextLine(); T stdIn.nextLine() stdIn.nextLine stdIn char[] s = S.toCharArray(); s S.toCharArray() S.toCharArray S char[] t = T.toCharArray(); t T.toCharArray() T.toCharArray T int minCount = 1000; minCount 1000 for(int i = 0; i <= s.length - t.length; i ++) {
			int counter = 0;
			for(int j = 0; j < t.length; j ++) {
				if(s[i + j] != t[j]) {
					counter ++;
				}
				if(minCount <= counter) {
					break;
				}
			}
			minCount = Math.min(minCount, counter);
		} int i = 0; int i = 0; i 0 i <= s.length - t.length i s.length - t.length s.length s s.length t.length t t.length i ++ i ++ i {
			int counter = 0;
			for(int j = 0; j < t.length; j ++) {
				if(s[i + j] != t[j]) {
					counter ++;
				}
				if(minCount <= counter) {
					break;
				}
			}
			minCount = Math.min(minCount, counter);
		} {
			int counter = 0;
			for(int j = 0; j < t.length; j ++) {
				if(s[i + j] != t[j]) {
					counter ++;
				}
				if(minCount <= counter) {
					break;
				}
			}
			minCount = Math.min(minCount, counter);
		} int counter = 0; counter 0 for(int j = 0; j < t.length; j ++) {
				if(s[i + j] != t[j]) {
					counter ++;
				}
				if(minCount <= counter) {
					break;
				}
			} 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]) {
					counter ++;
				}
				if(minCount <= counter) {
					break;
				}
			} {
				if(s[i + j] != t[j]) {
					counter ++;
				}
				if(minCount <= counter) {
					break;
				}
			} if(s[i + j] != t[j]) {
					counter ++;
				} s[i + j] != t[j] s[i + j] s i + j i j t[j] t j {
					counter ++;
				} counter ++ counter if(minCount <= counter) {
					break;
				} minCount <= counter minCount counter {
					break;
				} break; minCount = Math.min(minCount, counter) minCount Math.min(minCount, counter) Math.min Math minCount counter System.out.println(minCount) System.out.println System.out System System.out minCount String args[] args public class Main {
	public static void main(String args[]) {
		Scanner stdIn = new Scanner(System.in);
		String S = stdIn.nextLine();
		String T = stdIn.nextLine();
		
		char[] s = S.toCharArray();
		char[] t = T.toCharArray();
		
		int minCount = 1000;
		
		for(int i = 0; i <= s.length - t.length; i ++) {
			int counter = 0;
			for(int j = 0; j < t.length; j ++) {
				if(s[i + j] != t[j]) {
					counter ++;
				}
				if(minCount <= counter) {
					break;
				}
			}
			minCount = Math.min(minCount, counter);
		}
		
		System.out.println(minCount);
	}
} public class Main {
	public static void main(String args[]) {
		Scanner stdIn = new Scanner(System.in);
		String S = stdIn.nextLine();
		String T = stdIn.nextLine();
		
		char[] s = S.toCharArray();
		char[] t = T.toCharArray();
		
		int minCount = 1000;
		
		for(int i = 0; i <= s.length - t.length; i ++) {
			int counter = 0;
			for(int j = 0; j < t.length; j ++) {
				if(s[i + j] != t[j]) {
					counter ++;
				}
				if(minCount <= counter) {
					break;
				}
			}
			minCount = Math.min(minCount, counter);
		}
		
		System.out.println(minCount);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner stdIn = new Scanner(System.in);
		String S = stdIn.nextLine();
		String T = stdIn.nextLine();
		
		char[] s = S.toCharArray();
		char[] t = T.toCharArray();
		
		int minCount = 1000;
		
		for(int i = 0; i <= s.length - t.length; i ++) {
			int counter = 0;
			for(int j = 0; j < t.length; j ++) {
				if(s[i + j] != t[j]) {
					counter ++;
				}
				if(minCount <= counter) {
					break;
				}
			}
			minCount = Math.min(minCount, counter);
		}
		
		System.out.println(minCount);
	}
}