import java.util.*;
class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int sol = t.length();
		for (int i = 0; i <= s.length() - t.length(); i++) {
			int count = 0;
			int k = i;
			for (int j = 0; j < t.length(); j++) {
				if (s.charAt(k) != t.charAt(j)) {
					count++;
				}
				k++;
			}
			sol = Math.min(count, sol);
		}
		System.out.println(sol);
	}

} import java.util.*; util.* java class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int sol = t.length();
		for (int i = 0; i <= s.length() - t.length(); i++) {
			int count = 0;
			int k = i;
			for (int j = 0; j < t.length(); j++) {
				if (s.charAt(k) != t.charAt(j)) {
					count++;
				}
				k++;
			}
			sol = Math.min(count, sol);
		}
		System.out.println(sol);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int sol = t.length();
		for (int i = 0; i <= s.length() - t.length(); i++) {
			int count = 0;
			int k = i;
			for (int j = 0; j < t.length(); j++) {
				if (s.charAt(k) != t.charAt(j)) {
					count++;
				}
				k++;
			}
			sol = Math.min(count, sol);
		}
		System.out.println(sol);
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int sol = t.length();
		for (int i = 0; i <= s.length() - t.length(); i++) {
			int count = 0;
			int k = i;
			for (int j = 0; j < t.length(); j++) {
				if (s.charAt(k) != t.charAt(j)) {
					count++;
				}
				k++;
			}
			sol = Math.min(count, sol);
		}
		System.out.println(sol);
	} 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 sol = t.length(); sol t.length() t.length t for (int i = 0; i <= s.length() - t.length(); i++) {
			int count = 0;
			int k = i;
			for (int j = 0; j < t.length(); j++) {
				if (s.charAt(k) != t.charAt(j)) {
					count++;
				}
				k++;
			}
			sol = Math.min(count, sol);
		} 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 count = 0;
			int k = i;
			for (int j = 0; j < t.length(); j++) {
				if (s.charAt(k) != t.charAt(j)) {
					count++;
				}
				k++;
			}
			sol = Math.min(count, sol);
		} {
			int count = 0;
			int k = i;
			for (int j = 0; j < t.length(); j++) {
				if (s.charAt(k) != t.charAt(j)) {
					count++;
				}
				k++;
			}
			sol = Math.min(count, sol);
		} int count = 0; count 0 int k = i; k i for (int j = 0; j < t.length(); j++) {
				if (s.charAt(k) != t.charAt(j)) {
					count++;
				}
				k++;
			} int j = 0; int j = 0; j 0 j < t.length() j t.length() t.length t j++ j++ j {
				if (s.charAt(k) != t.charAt(j)) {
					count++;
				}
				k++;
			} {
				if (s.charAt(k) != t.charAt(j)) {
					count++;
				}
				k++;
			} if (s.charAt(k) != t.charAt(j)) {
					count++;
				} s.charAt(k) != t.charAt(j) s.charAt(k) s.charAt s k t.charAt(j) t.charAt t j {
					count++;
				} count++ count k++ k sol = Math.min(count, sol) sol Math.min(count, sol) Math.min Math count sol System.out.println(sol) System.out.println System.out System System.out sol String[] args args
import java.util.*;
class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int sol = t.length();
		for (int i = 0; i <= s.length() - t.length(); i++) {
			int count = 0;
			int k = i;
			for (int j = 0; j < t.length(); j++) {
				if (s.charAt(k) != t.charAt(j)) {
					count++;
				}
				k++;
			}
			sol = Math.min(count, sol);
		}
		System.out.println(sol);
	}

}