import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		String s = in.next();
		String t = in.next();
		int ans = 9999;
		for (int i = 0; i <= s.length() - t.length(); i++) {
			int x = countUnmatch(s.substring(i, i + t.length()), t);
			if (x < ans)
				ans = x;
		}
		System.out.println(ans);
	}

	private static int countUnmatch(String s, String t) {
		int ans = 0;
		for (int i = 0; i < s.length(); i++)
			if (s.charAt(i) != t.charAt(i))
				ans++;
		return ans;
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		String s = in.next();
		String t = in.next();
		int ans = 9999;
		for (int i = 0; i <= s.length() - t.length(); i++) {
			int x = countUnmatch(s.substring(i, i + t.length()), t);
			if (x < ans)
				ans = x;
		}
		System.out.println(ans);
	}

	private static int countUnmatch(String s, String t) {
		int ans = 0;
		for (int i = 0; i < s.length(); i++)
			if (s.charAt(i) != t.charAt(i))
				ans++;
		return ans;
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		String s = in.next();
		String t = in.next();
		int ans = 9999;
		for (int i = 0; i <= s.length() - t.length(); i++) {
			int x = countUnmatch(s.substring(i, i + t.length()), t);
			if (x < ans)
				ans = x;
		}
		System.out.println(ans);
	} main {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		String s = in.next();
		String t = in.next();
		int ans = 9999;
		for (int i = 0; i <= s.length() - t.length(); i++) {
			int x = countUnmatch(s.substring(i, i + t.length()), t);
			if (x < ans)
				ans = x;
		}
		System.out.println(ans);
	} Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); in new Scanner(new BufferedReader(new InputStreamReader(System.in))) String s = in.next(); s in.next() in.next in String t = in.next(); t in.next() in.next in int ans = 9999; ans 9999 for (int i = 0; i <= s.length() - t.length(); i++) {
			int x = countUnmatch(s.substring(i, i + t.length()), t);
			if (x < ans)
				ans = x;
		} 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 x = countUnmatch(s.substring(i, i + t.length()), t);
			if (x < ans)
				ans = x;
		} {
			int x = countUnmatch(s.substring(i, i + t.length()), t);
			if (x < ans)
				ans = x;
		} int x = countUnmatch(s.substring(i, i + t.length()), t); x countUnmatch(s.substring(i, i + t.length()), t) countUnmatch s.substring(i, i + t.length()) s.substring s i i + t.length() i t.length() t.length t t if (x < ans)
				ans = x; x < ans x ans ans = x ans x System.out.println(ans) System.out.println System.out System System.out ans String[] args args private static int countUnmatch(String s, String t) {
		int ans = 0;
		for (int i = 0; i < s.length(); i++)
			if (s.charAt(i) != t.charAt(i))
				ans++;
		return ans;
	} countUnmatch {
		int ans = 0;
		for (int i = 0; i < s.length(); i++)
			if (s.charAt(i) != t.charAt(i))
				ans++;
		return ans;
	} int ans = 0; ans 0 for (int i = 0; i < s.length(); i++)
			if (s.charAt(i) != t.charAt(i))
				ans++; int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i if (s.charAt(i) != t.charAt(i))
				ans++; if (s.charAt(i) != t.charAt(i))
				ans++; s.charAt(i) != t.charAt(i) s.charAt(i) s.charAt s i t.charAt(i) t.charAt t i ans++ ans return ans; ans String s s String t t public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		String s = in.next();
		String t = in.next();
		int ans = 9999;
		for (int i = 0; i <= s.length() - t.length(); i++) {
			int x = countUnmatch(s.substring(i, i + t.length()), t);
			if (x < ans)
				ans = x;
		}
		System.out.println(ans);
	}

	private static int countUnmatch(String s, String t) {
		int ans = 0;
		for (int i = 0; i < s.length(); i++)
			if (s.charAt(i) != t.charAt(i))
				ans++;
		return ans;
	}
} public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		String s = in.next();
		String t = in.next();
		int ans = 9999;
		for (int i = 0; i <= s.length() - t.length(); i++) {
			int x = countUnmatch(s.substring(i, i + t.length()), t);
			if (x < ans)
				ans = x;
		}
		System.out.println(ans);
	}

	private static int countUnmatch(String s, String t) {
		int ans = 0;
		for (int i = 0; i < s.length(); i++)
			if (s.charAt(i) != t.charAt(i))
				ans++;
		return ans;
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		String s = in.next();
		String t = in.next();
		int ans = 9999;
		for (int i = 0; i <= s.length() - t.length(); i++) {
			int x = countUnmatch(s.substring(i, i + t.length()), t);
			if (x < ans)
				ans = x;
		}
		System.out.println(ans);
	}

	private static int countUnmatch(String s, String t) {
		int ans = 0;
		for (int i = 0; i < s.length(); i++)
			if (s.charAt(i) != t.charAt(i))
				ans++;
		return ans;
	}
}
