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 max = 0;

		for (int i = 0; i <= s.length() - t.length(); i++) {
			int match = 0;
			for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i + j)) {
					match++;
				}
			}
			if (max < match) {
				max = match;
			}
		}
		System.out.println(t.length() - max);
	}
} 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 max = 0;

		for (int i = 0; i <= s.length() - t.length(); i++) {
			int match = 0;
			for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i + j)) {
					match++;
				}
			}
			if (max < match) {
				max = match;
			}
		}
		System.out.println(t.length() - max);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int max = 0;

		for (int i = 0; i <= s.length() - t.length(); i++) {
			int match = 0;
			for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i + j)) {
					match++;
				}
			}
			if (max < match) {
				max = match;
			}
		}
		System.out.println(t.length() - max);
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int max = 0;

		for (int i = 0; i <= s.length() - t.length(); i++) {
			int match = 0;
			for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i + j)) {
					match++;
				}
			}
			if (max < match) {
				max = match;
			}
		}
		System.out.println(t.length() - max);
	} 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 max = 0; max 0 for (int i = 0; i <= s.length() - t.length(); i++) {
			int match = 0;
			for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i + j)) {
					match++;
				}
			}
			if (max < match) {
				max = match;
			}
		} 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 match = 0;
			for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i + j)) {
					match++;
				}
			}
			if (max < match) {
				max = match;
			}
		} {
			int match = 0;
			for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i + j)) {
					match++;
				}
			}
			if (max < match) {
				max = match;
			}
		} int match = 0; match 0 for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i + j)) {
					match++;
				}
			} int j = 0; int j = 0; j 0 j < t.length() j t.length() t.length t j++ j++ j {
				if (t.charAt(j) == s.charAt(i + j)) {
					match++;
				}
			} {
				if (t.charAt(j) == s.charAt(i + j)) {
					match++;
				}
			} if (t.charAt(j) == s.charAt(i + j)) {
					match++;
				} t.charAt(j) == s.charAt(i + j) t.charAt(j) t.charAt t j s.charAt(i + j) s.charAt s i + j i j {
					match++;
				} match++ match if (max < match) {
				max = match;
			} max < match max match {
				max = match;
			} max = match max match System.out.println(t.length() - max) System.out.println System.out System System.out t.length() - max t.length() t.length t max 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 max = 0;

		for (int i = 0; i <= s.length() - t.length(); i++) {
			int match = 0;
			for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i + j)) {
					match++;
				}
			}
			if (max < match) {
				max = match;
			}
		}
		System.out.println(t.length() - max);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int max = 0;

		for (int i = 0; i <= s.length() - t.length(); i++) {
			int match = 0;
			for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i + j)) {
					match++;
				}
			}
			if (max < match) {
				max = match;
			}
		}
		System.out.println(t.length() - max);
	}
} 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 max = 0;

		for (int i = 0; i <= s.length() - t.length(); i++) {
			int match = 0;
			for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i + j)) {
					match++;
				}
			}
			if (max < match) {
				max = match;
			}
		}
		System.out.println(t.length() - max);
	}
}