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[] ScharArray = S.toCharArray();
		char[] TcharArray = T.toCharArray();
		
		// 結果の出力
		int count = T.length();
		for (int i = 0; i <= (S.length() - T.length()); i++) {
			int diff = 0;
			for (int j = 0; j < T.length(); j++) {
				if (TcharArray[j] != ScharArray[i + j]) {
					diff++;
				}
			}
			count = Math.min(count, diff);
		}
		System.out.println(count);
		
		sc.close();
	}
} 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[] ScharArray = S.toCharArray();
		char[] TcharArray = T.toCharArray();
		
		// 結果の出力
		int count = T.length();
		for (int i = 0; i <= (S.length() - T.length()); i++) {
			int diff = 0;
			for (int j = 0; j < T.length(); j++) {
				if (TcharArray[j] != ScharArray[i + j]) {
					diff++;
				}
			}
			count = Math.min(count, diff);
		}
		System.out.println(count);
		
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		// 入力値の取得
		String S = sc.next();
		String T = sc.next();
		char[] ScharArray = S.toCharArray();
		char[] TcharArray = T.toCharArray();
		
		// 結果の出力
		int count = T.length();
		for (int i = 0; i <= (S.length() - T.length()); i++) {
			int diff = 0;
			for (int j = 0; j < T.length(); j++) {
				if (TcharArray[j] != ScharArray[i + j]) {
					diff++;
				}
			}
			count = Math.min(count, diff);
		}
		System.out.println(count);
		
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);

		// 入力値の取得
		String S = sc.next();
		String T = sc.next();
		char[] ScharArray = S.toCharArray();
		char[] TcharArray = T.toCharArray();
		
		// 結果の出力
		int count = T.length();
		for (int i = 0; i <= (S.length() - T.length()); i++) {
			int diff = 0;
			for (int j = 0; j < T.length(); j++) {
				if (TcharArray[j] != ScharArray[i + j]) {
					diff++;
				}
			}
			count = Math.min(count, diff);
		}
		System.out.println(count);
		
		sc.close();
	} 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[] ScharArray = S.toCharArray(); ScharArray S.toCharArray() S.toCharArray S char[] TcharArray = T.toCharArray(); TcharArray T.toCharArray() T.toCharArray T int count = T.length(); count T.length() T.length T for (int i = 0; i <= (S.length() - T.length()); i++) {
			int diff = 0;
			for (int j = 0; j < T.length(); j++) {
				if (TcharArray[j] != ScharArray[i + j]) {
					diff++;
				}
			}
			count = Math.min(count, diff);
		} 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 diff = 0;
			for (int j = 0; j < T.length(); j++) {
				if (TcharArray[j] != ScharArray[i + j]) {
					diff++;
				}
			}
			count = Math.min(count, diff);
		} {
			int diff = 0;
			for (int j = 0; j < T.length(); j++) {
				if (TcharArray[j] != ScharArray[i + j]) {
					diff++;
				}
			}
			count = Math.min(count, diff);
		} int diff = 0; diff 0 for (int j = 0; j < T.length(); j++) {
				if (TcharArray[j] != ScharArray[i + j]) {
					diff++;
				}
			} int j = 0; int j = 0; j 0 j < T.length() j T.length() T.length T j++ j++ j {
				if (TcharArray[j] != ScharArray[i + j]) {
					diff++;
				}
			} {
				if (TcharArray[j] != ScharArray[i + j]) {
					diff++;
				}
			} if (TcharArray[j] != ScharArray[i + j]) {
					diff++;
				} TcharArray[j] != ScharArray[i + j] TcharArray[j] TcharArray j ScharArray[i + j] ScharArray i + j i j {
					diff++;
				} diff++ diff count = Math.min(count, diff) count Math.min(count, diff) Math.min Math count diff System.out.println(count) System.out.println System.out System System.out count sc.close() sc.close sc 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[] ScharArray = S.toCharArray();
		char[] TcharArray = T.toCharArray();
		
		// 結果の出力
		int count = T.length();
		for (int i = 0; i <= (S.length() - T.length()); i++) {
			int diff = 0;
			for (int j = 0; j < T.length(); j++) {
				if (TcharArray[j] != ScharArray[i + j]) {
					diff++;
				}
			}
			count = Math.min(count, diff);
		}
		System.out.println(count);
		
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		// 入力値の取得
		String S = sc.next();
		String T = sc.next();
		char[] ScharArray = S.toCharArray();
		char[] TcharArray = T.toCharArray();
		
		// 結果の出力
		int count = T.length();
		for (int i = 0; i <= (S.length() - T.length()); i++) {
			int diff = 0;
			for (int j = 0; j < T.length(); j++) {
				if (TcharArray[j] != ScharArray[i + j]) {
					diff++;
				}
			}
			count = Math.min(count, diff);
		}
		System.out.println(count);
		
		sc.close();
	}
} 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[] ScharArray = S.toCharArray();
		char[] TcharArray = T.toCharArray();
		
		// 結果の出力
		int count = T.length();
		for (int i = 0; i <= (S.length() - T.length()); i++) {
			int diff = 0;
			for (int j = 0; j < T.length(); j++) {
				if (TcharArray[j] != ScharArray[i + j]) {
					diff++;
				}
			}
			count = Math.min(count, diff);
		}
		System.out.println(count);
		
		sc.close();
	}
}
