import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();

		int ans = 1000;

		for (int i = 0; i <= s.length() - t.length(); i++) {
			int tmp = 0;

			for (int j = 0; j < t.length(); j++) {
				if (!(s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1)))) {
					tmp++;
				}
			}

			if (tmp < ans) {
				ans = tmp;
			}

		}

		System.out.println(ans);

		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.nextLine();
		String t = sc.nextLine();

		int ans = 1000;

		for (int i = 0; i <= s.length() - t.length(); i++) {
			int tmp = 0;

			for (int j = 0; j < t.length(); j++) {
				if (!(s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1)))) {
					tmp++;
				}
			}

			if (tmp < ans) {
				ans = tmp;
			}

		}

		System.out.println(ans);

		sc.close();
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();

		int ans = 1000;

		for (int i = 0; i <= s.length() - t.length(); i++) {
			int tmp = 0;

			for (int j = 0; j < t.length(); j++) {
				if (!(s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1)))) {
					tmp++;
				}
			}

			if (tmp < ans) {
				ans = tmp;
			}

		}

		System.out.println(ans);

		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();

		int ans = 1000;

		for (int i = 0; i <= s.length() - t.length(); i++) {
			int tmp = 0;

			for (int j = 0; j < t.length(); j++) {
				if (!(s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1)))) {
					tmp++;
				}
			}

			if (tmp < ans) {
				ans = tmp;
			}

		}

		System.out.println(ans);

		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String t = sc.nextLine(); t sc.nextLine() sc.nextLine sc int ans = 1000; ans 1000 for (int i = 0; i <= s.length() - t.length(); i++) {
			int tmp = 0;

			for (int j = 0; j < t.length(); j++) {
				if (!(s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1)))) {
					tmp++;
				}
			}

			if (tmp < ans) {
				ans = tmp;
			}

		} 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 tmp = 0;

			for (int j = 0; j < t.length(); j++) {
				if (!(s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1)))) {
					tmp++;
				}
			}

			if (tmp < ans) {
				ans = tmp;
			}

		} {
			int tmp = 0;

			for (int j = 0; j < t.length(); j++) {
				if (!(s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1)))) {
					tmp++;
				}
			}

			if (tmp < ans) {
				ans = tmp;
			}

		} int tmp = 0; tmp 0 for (int j = 0; j < t.length(); j++) {
				if (!(s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1)))) {
					tmp++;
				}
			} int j = 0; int j = 0; j 0 j < t.length() j t.length() t.length t j++ j++ j {
				if (!(s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1)))) {
					tmp++;
				}
			} {
				if (!(s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1)))) {
					tmp++;
				}
			} if (!(s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1)))) {
					tmp++;
				} !(s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1))) (s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1))) s.substring(i + j, i + j + 1).equals s.substring(i + j, i + j + 1) s.substring s i + j i j i + j + 1 i + j + 1 i j 1 t.substring(j, j + 1) t.substring t j j + 1 j 1 {
					tmp++;
				} tmp++ tmp if (tmp < ans) {
				ans = tmp;
			} tmp < ans tmp ans {
				ans = tmp;
			} ans = tmp ans tmp System.out.println(ans) System.out.println System.out System System.out ans 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.nextLine();
		String t = sc.nextLine();

		int ans = 1000;

		for (int i = 0; i <= s.length() - t.length(); i++) {
			int tmp = 0;

			for (int j = 0; j < t.length(); j++) {
				if (!(s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1)))) {
					tmp++;
				}
			}

			if (tmp < ans) {
				ans = tmp;
			}

		}

		System.out.println(ans);

		sc.close();
	}

} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();

		int ans = 1000;

		for (int i = 0; i <= s.length() - t.length(); i++) {
			int tmp = 0;

			for (int j = 0; j < t.length(); j++) {
				if (!(s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1)))) {
					tmp++;
				}
			}

			if (tmp < ans) {
				ans = tmp;
			}

		}

		System.out.println(ans);

		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.nextLine();
		String t = sc.nextLine();

		int ans = 1000;

		for (int i = 0; i <= s.length() - t.length(); i++) {
			int tmp = 0;

			for (int j = 0; j < t.length(); j++) {
				if (!(s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1)))) {
					tmp++;
				}
			}

			if (tmp < ans) {
				ans = tmp;
			}

		}

		System.out.println(ans);

		sc.close();
	}

}