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 min = -1;

		if (S.equals(T)) {
			System.out.println(0);
		}else {
			for (int i = T.length(); i <= S.length(); i++) {
				String string = S.substring(i - T.length(),i);
				int let = 0;
				for (int j = 0; j < T.length(); j++) {
					if (string.charAt(j) == T.charAt(j)) {
						let++;
					}
				}
				min = Math.max(min, let);
			}

			System.out.println(T.length() - min);
		}
	}

} 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 min = -1;

		if (S.equals(T)) {
			System.out.println(0);
		}else {
			for (int i = T.length(); i <= S.length(); i++) {
				String string = S.substring(i - T.length(),i);
				int let = 0;
				for (int j = 0; j < T.length(); j++) {
					if (string.charAt(j) == T.charAt(j)) {
						let++;
					}
				}
				min = Math.max(min, let);
			}

			System.out.println(T.length() - min);
		}
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int min = -1;

		if (S.equals(T)) {
			System.out.println(0);
		}else {
			for (int i = T.length(); i <= S.length(); i++) {
				String string = S.substring(i - T.length(),i);
				int let = 0;
				for (int j = 0; j < T.length(); j++) {
					if (string.charAt(j) == T.charAt(j)) {
						let++;
					}
				}
				min = Math.max(min, let);
			}

			System.out.println(T.length() - min);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int min = -1;

		if (S.equals(T)) {
			System.out.println(0);
		}else {
			for (int i = T.length(); i <= S.length(); i++) {
				String string = S.substring(i - T.length(),i);
				int let = 0;
				for (int j = 0; j < T.length(); j++) {
					if (string.charAt(j) == T.charAt(j)) {
						let++;
					}
				}
				min = Math.max(min, let);
			}

			System.out.println(T.length() - min);
		}
	} 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 min = -1; min -1 1 if (S.equals(T)) {
			System.out.println(0);
		}else {
			for (int i = T.length(); i <= S.length(); i++) {
				String string = S.substring(i - T.length(),i);
				int let = 0;
				for (int j = 0; j < T.length(); j++) {
					if (string.charAt(j) == T.charAt(j)) {
						let++;
					}
				}
				min = Math.max(min, let);
			}

			System.out.println(T.length() - min);
		} S.equals(T) S.equals S T {
			System.out.println(0);
		} System.out.println(0) System.out.println System.out System System.out 0 {
			for (int i = T.length(); i <= S.length(); i++) {
				String string = S.substring(i - T.length(),i);
				int let = 0;
				for (int j = 0; j < T.length(); j++) {
					if (string.charAt(j) == T.charAt(j)) {
						let++;
					}
				}
				min = Math.max(min, let);
			}

			System.out.println(T.length() - min);
		} for (int i = T.length(); i <= S.length(); i++) {
				String string = S.substring(i - T.length(),i);
				int let = 0;
				for (int j = 0; j < T.length(); j++) {
					if (string.charAt(j) == T.charAt(j)) {
						let++;
					}
				}
				min = Math.max(min, let);
			} int i = T.length(); int i = T.length(); i T.length() T.length T i <= S.length() i S.length() S.length S i++ i++ i {
				String string = S.substring(i - T.length(),i);
				int let = 0;
				for (int j = 0; j < T.length(); j++) {
					if (string.charAt(j) == T.charAt(j)) {
						let++;
					}
				}
				min = Math.max(min, let);
			} {
				String string = S.substring(i - T.length(),i);
				int let = 0;
				for (int j = 0; j < T.length(); j++) {
					if (string.charAt(j) == T.charAt(j)) {
						let++;
					}
				}
				min = Math.max(min, let);
			} String string = S.substring(i - T.length(),i); string S.substring(i - T.length(),i) S.substring S i - T.length() i T.length() T.length T i int let = 0; let 0 for (int j = 0; j < T.length(); j++) {
					if (string.charAt(j) == T.charAt(j)) {
						let++;
					}
				} int j = 0; int j = 0; j 0 j < T.length() j T.length() T.length T j++ j++ j {
					if (string.charAt(j) == T.charAt(j)) {
						let++;
					}
				} {
					if (string.charAt(j) == T.charAt(j)) {
						let++;
					}
				} if (string.charAt(j) == T.charAt(j)) {
						let++;
					} string.charAt(j) == T.charAt(j) string.charAt(j) string.charAt string j T.charAt(j) T.charAt T j {
						let++;
					} let++ let min = Math.max(min, let) min Math.max(min, let) Math.max Math min let System.out.println(T.length() - min) System.out.println System.out System System.out T.length() - min T.length() T.length T min 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 min = -1;

		if (S.equals(T)) {
			System.out.println(0);
		}else {
			for (int i = T.length(); i <= S.length(); i++) {
				String string = S.substring(i - T.length(),i);
				int let = 0;
				for (int j = 0; j < T.length(); j++) {
					if (string.charAt(j) == T.charAt(j)) {
						let++;
					}
				}
				min = Math.max(min, let);
			}

			System.out.println(T.length() - min);
		}
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int min = -1;

		if (S.equals(T)) {
			System.out.println(0);
		}else {
			for (int i = T.length(); i <= S.length(); i++) {
				String string = S.substring(i - T.length(),i);
				int let = 0;
				for (int j = 0; j < T.length(); j++) {
					if (string.charAt(j) == T.charAt(j)) {
						let++;
					}
				}
				min = Math.max(min, let);
			}

			System.out.println(T.length() - min);
		}
	}

} 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 min = -1;

		if (S.equals(T)) {
			System.out.println(0);
		}else {
			for (int i = T.length(); i <= S.length(); i++) {
				String string = S.substring(i - T.length(),i);
				int let = 0;
				for (int j = 0; j < T.length(); j++) {
					if (string.charAt(j) == T.charAt(j)) {
						let++;
					}
				}
				min = Math.max(min, let);
			}

			System.out.println(T.length() - min);
		}
	}

}