import java.util.Scanner;

public class Main {

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

			int roopCount = (s.length() -  t.length()) + 1;

			int ans = t.length();
			char[] sArr = s.toCharArray();
			char[] tArr = t.toCharArray();
			for (int i = 0; i < roopCount; i++) {
				int index = i;
				int res = 0;
				boolean isEqual = false;
				for (char tc : tArr) {
					if (tc == sArr[index++]) {
						isEqual = true;
						res++;
					}
				}
				if (isEqual) {
					ans = Math.min(ans, (t.length() - res));
				}
			}

			System.out.println(ans);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

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

			int roopCount = (s.length() -  t.length()) + 1;

			int ans = t.length();
			char[] sArr = s.toCharArray();
			char[] tArr = t.toCharArray();
			for (int i = 0; i < roopCount; i++) {
				int index = i;
				int res = 0;
				boolean isEqual = false;
				for (char tc : tArr) {
					if (tc == sArr[index++]) {
						isEqual = true;
						res++;
					}
				}
				if (isEqual) {
					ans = Math.min(ans, (t.length() - res));
				}
			}

			System.out.println(ans);
		}
	}
} Main public static void main(String[] args) {
		try(Scanner scanner = new Scanner(System.in)) {
			String s = scanner.nextLine();
			String t = scanner.nextLine();

			int roopCount = (s.length() -  t.length()) + 1;

			int ans = t.length();
			char[] sArr = s.toCharArray();
			char[] tArr = t.toCharArray();
			for (int i = 0; i < roopCount; i++) {
				int index = i;
				int res = 0;
				boolean isEqual = false;
				for (char tc : tArr) {
					if (tc == sArr[index++]) {
						isEqual = true;
						res++;
					}
				}
				if (isEqual) {
					ans = Math.min(ans, (t.length() - res));
				}
			}

			System.out.println(ans);
		}
	} main {
		try(Scanner scanner = new Scanner(System.in)) {
			String s = scanner.nextLine();
			String t = scanner.nextLine();

			int roopCount = (s.length() -  t.length()) + 1;

			int ans = t.length();
			char[] sArr = s.toCharArray();
			char[] tArr = t.toCharArray();
			for (int i = 0; i < roopCount; i++) {
				int index = i;
				int res = 0;
				boolean isEqual = false;
				for (char tc : tArr) {
					if (tc == sArr[index++]) {
						isEqual = true;
						res++;
					}
				}
				if (isEqual) {
					ans = Math.min(ans, (t.length() - res));
				}
			}

			System.out.println(ans);
		}
	} try(Scanner scanner = new Scanner(System.in)) {
			String s = scanner.nextLine();
			String t = scanner.nextLine();

			int roopCount = (s.length() -  t.length()) + 1;

			int ans = t.length();
			char[] sArr = s.toCharArray();
			char[] tArr = t.toCharArray();
			for (int i = 0; i < roopCount; i++) {
				int index = i;
				int res = 0;
				boolean isEqual = false;
				for (char tc : tArr) {
					if (tc == sArr[index++]) {
						isEqual = true;
						res++;
					}
				}
				if (isEqual) {
					ans = Math.min(ans, (t.length() - res));
				}
			}

			System.out.println(ans);
		} {
			String s = scanner.nextLine();
			String t = scanner.nextLine();

			int roopCount = (s.length() -  t.length()) + 1;

			int ans = t.length();
			char[] sArr = s.toCharArray();
			char[] tArr = t.toCharArray();
			for (int i = 0; i < roopCount; i++) {
				int index = i;
				int res = 0;
				boolean isEqual = false;
				for (char tc : tArr) {
					if (tc == sArr[index++]) {
						isEqual = true;
						res++;
					}
				}
				if (isEqual) {
					ans = Math.min(ans, (t.length() - res));
				}
			}

			System.out.println(ans);
		} Scanner scanner = new Scanner(System.in) Scanner scanner = new Scanner(System.in) new Scanner(System.in) String s = scanner.nextLine(); s scanner.nextLine() scanner.nextLine scanner String t = scanner.nextLine(); t scanner.nextLine() scanner.nextLine scanner int roopCount = (s.length() -  t.length()) + 1; roopCount (s.length() -  t.length()) + 1 (s.length() -  t.length()) s.length() s.length s t.length() t.length t 1 int ans = t.length(); ans t.length() t.length t char[] sArr = s.toCharArray(); sArr s.toCharArray() s.toCharArray s char[] tArr = t.toCharArray(); tArr t.toCharArray() t.toCharArray t for (int i = 0; i < roopCount; i++) {
				int index = i;
				int res = 0;
				boolean isEqual = false;
				for (char tc : tArr) {
					if (tc == sArr[index++]) {
						isEqual = true;
						res++;
					}
				}
				if (isEqual) {
					ans = Math.min(ans, (t.length() - res));
				}
			} int i = 0; int i = 0; i 0 i < roopCount i roopCount i++ i++ i {
				int index = i;
				int res = 0;
				boolean isEqual = false;
				for (char tc : tArr) {
					if (tc == sArr[index++]) {
						isEqual = true;
						res++;
					}
				}
				if (isEqual) {
					ans = Math.min(ans, (t.length() - res));
				}
			} {
				int index = i;
				int res = 0;
				boolean isEqual = false;
				for (char tc : tArr) {
					if (tc == sArr[index++]) {
						isEqual = true;
						res++;
					}
				}
				if (isEqual) {
					ans = Math.min(ans, (t.length() - res));
				}
			} int index = i; index i int res = 0; res 0 boolean isEqual = false; isEqual false for (char tc : tArr) {
					if (tc == sArr[index++]) {
						isEqual = true;
						res++;
					}
				} char tc tArr {
					if (tc == sArr[index++]) {
						isEqual = true;
						res++;
					}
				} {
					if (tc == sArr[index++]) {
						isEqual = true;
						res++;
					}
				} if (tc == sArr[index++]) {
						isEqual = true;
						res++;
					} tc == sArr[index++] tc sArr[index++] sArr index++ index {
						isEqual = true;
						res++;
					} isEqual = true isEqual true res++ res if (isEqual) {
					ans = Math.min(ans, (t.length() - res));
				} isEqual {
					ans = Math.min(ans, (t.length() - res));
				} ans = Math.min(ans, (t.length() - res)) ans Math.min(ans, (t.length() - res)) Math.min Math ans (t.length() - res) t.length() t.length t res 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 scanner = new Scanner(System.in)) {
			String s = scanner.nextLine();
			String t = scanner.nextLine();

			int roopCount = (s.length() -  t.length()) + 1;

			int ans = t.length();
			char[] sArr = s.toCharArray();
			char[] tArr = t.toCharArray();
			for (int i = 0; i < roopCount; i++) {
				int index = i;
				int res = 0;
				boolean isEqual = false;
				for (char tc : tArr) {
					if (tc == sArr[index++]) {
						isEqual = true;
						res++;
					}
				}
				if (isEqual) {
					ans = Math.min(ans, (t.length() - res));
				}
			}

			System.out.println(ans);
		}
	}
} public class Main {

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

			int roopCount = (s.length() -  t.length()) + 1;

			int ans = t.length();
			char[] sArr = s.toCharArray();
			char[] tArr = t.toCharArray();
			for (int i = 0; i < roopCount; i++) {
				int index = i;
				int res = 0;
				boolean isEqual = false;
				for (char tc : tArr) {
					if (tc == sArr[index++]) {
						isEqual = true;
						res++;
					}
				}
				if (isEqual) {
					ans = Math.min(ans, (t.length() - res));
				}
			}

			System.out.println(ans);
		}
	}
} Main
import java.util.Scanner;

public class Main {

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

			int roopCount = (s.length() -  t.length()) + 1;

			int ans = t.length();
			char[] sArr = s.toCharArray();
			char[] tArr = t.toCharArray();
			for (int i = 0; i < roopCount; i++) {
				int index = i;
				int res = 0;
				boolean isEqual = false;
				for (char tc : tArr) {
					if (tc == sArr[index++]) {
						isEqual = true;
						res++;
					}
				}
				if (isEqual) {
					ans = Math.min(ans, (t.length() - res));
				}
			}

			System.out.println(ans);
		}
	}
}