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();
		int minChanges = Integer.MAX_VALUE;
		for(int i = 0 ; i <= S.length() - T.length(); i++) {
			int iter = 0;
			int temp = 0;
			while(iter < T.length()) {
				if(S.charAt(i+iter) != T.charAt(iter)) {
					temp++;
				}
				iter++;
			}
			minChanges = Math.min(temp, minChanges);
		}
		System.out.println(minChanges);
	}
} 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();
		int minChanges = Integer.MAX_VALUE;
		for(int i = 0 ; i <= S.length() - T.length(); i++) {
			int iter = 0;
			int temp = 0;
			while(iter < T.length()) {
				if(S.charAt(i+iter) != T.charAt(iter)) {
					temp++;
				}
				iter++;
			}
			minChanges = Math.min(temp, minChanges);
		}
		System.out.println(minChanges);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int minChanges = Integer.MAX_VALUE;
		for(int i = 0 ; i <= S.length() - T.length(); i++) {
			int iter = 0;
			int temp = 0;
			while(iter < T.length()) {
				if(S.charAt(i+iter) != T.charAt(iter)) {
					temp++;
				}
				iter++;
			}
			minChanges = Math.min(temp, minChanges);
		}
		System.out.println(minChanges);
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int minChanges = Integer.MAX_VALUE;
		for(int i = 0 ; i <= S.length() - T.length(); i++) {
			int iter = 0;
			int temp = 0;
			while(iter < T.length()) {
				if(S.charAt(i+iter) != T.charAt(iter)) {
					temp++;
				}
				iter++;
			}
			minChanges = Math.min(temp, minChanges);
		}
		System.out.println(minChanges);
	} 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 int minChanges = Integer.MAX_VALUE; minChanges Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i = 0 ; i <= S.length() - T.length(); i++) {
			int iter = 0;
			int temp = 0;
			while(iter < T.length()) {
				if(S.charAt(i+iter) != T.charAt(iter)) {
					temp++;
				}
				iter++;
			}
			minChanges = Math.min(temp, minChanges);
		} int i = 0 ; int i = 0 ; i 0 i <= S.length() - T.length() i S.length() - T.length() S.length() S.length S T.length() T.length T i++ i++ i {
			int iter = 0;
			int temp = 0;
			while(iter < T.length()) {
				if(S.charAt(i+iter) != T.charAt(iter)) {
					temp++;
				}
				iter++;
			}
			minChanges = Math.min(temp, minChanges);
		} {
			int iter = 0;
			int temp = 0;
			while(iter < T.length()) {
				if(S.charAt(i+iter) != T.charAt(iter)) {
					temp++;
				}
				iter++;
			}
			minChanges = Math.min(temp, minChanges);
		} int iter = 0; iter 0 int temp = 0; temp 0 while(iter < T.length()) {
				if(S.charAt(i+iter) != T.charAt(iter)) {
					temp++;
				}
				iter++;
			} iter < T.length() iter T.length() T.length T {
				if(S.charAt(i+iter) != T.charAt(iter)) {
					temp++;
				}
				iter++;
			} if(S.charAt(i+iter) != T.charAt(iter)) {
					temp++;
				} S.charAt(i+iter) != T.charAt(iter) S.charAt(i+iter) S.charAt S i+iter i iter T.charAt(iter) T.charAt T iter {
					temp++;
				} temp++ temp iter++ iter minChanges = Math.min(temp, minChanges) minChanges Math.min(temp, minChanges) Math.min Math temp minChanges System.out.println(minChanges) System.out.println System.out System System.out minChanges 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();
		int minChanges = Integer.MAX_VALUE;
		for(int i = 0 ; i <= S.length() - T.length(); i++) {
			int iter = 0;
			int temp = 0;
			while(iter < T.length()) {
				if(S.charAt(i+iter) != T.charAt(iter)) {
					temp++;
				}
				iter++;
			}
			minChanges = Math.min(temp, minChanges);
		}
		System.out.println(minChanges);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int minChanges = Integer.MAX_VALUE;
		for(int i = 0 ; i <= S.length() - T.length(); i++) {
			int iter = 0;
			int temp = 0;
			while(iter < T.length()) {
				if(S.charAt(i+iter) != T.charAt(iter)) {
					temp++;
				}
				iter++;
			}
			minChanges = Math.min(temp, minChanges);
		}
		System.out.println(minChanges);
	}
} 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();
		int minChanges = Integer.MAX_VALUE;
		for(int i = 0 ; i <= S.length() - T.length(); i++) {
			int iter = 0;
			int temp = 0;
			while(iter < T.length()) {
				if(S.charAt(i+iter) != T.charAt(iter)) {
					temp++;
				}
				iter++;
			}
			minChanges = Math.min(temp, minChanges);
		}
		System.out.println(minChanges);
	}
}
