import java.util.Scanner;

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

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String s = sc.next();
			String t = sc.next();
			int slen = s.length();
			int tlen = t.length();
			int ans = Integer.MAX_VALUE;
			for (int i = 0; i <= slen - tlen; i++) {
				int tmpans = 0;
				String tmps = s.substring(i, i + tlen);
				for (int j = 0; j < tlen; j++) {
					if (tmps.charAt(j) != t.charAt(j)) {
						tmpans++;
					}
				}
				ans = Math.min(ans, tmpans);
			}
			System.out.println(ans);
		}
	}
}