import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s = in.readLine();
		String t = in.readLine();
		int min = t.length();
		for (int i = 0; i <= s.length()-t.length(); i++) {
			int change = t.length();
			for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i+j))
					change--;
			}
			min = Math.min(change, min);
		}
		System.out.println(min);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s = in.readLine();
		String t = in.readLine();
		int min = t.length();
		for (int i = 0; i <= s.length()-t.length(); i++) {
			int change = t.length();
			for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i+j))
					change--;
			}
			min = Math.min(change, min);
		}
		System.out.println(min);
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s = in.readLine();
		String t = in.readLine();
		int min = t.length();
		for (int i = 0; i <= s.length()-t.length(); i++) {
			int change = t.length();
			for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i+j))
					change--;
			}
			min = Math.min(change, min);
		}
		System.out.println(min);
	} main {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s = in.readLine();
		String t = in.readLine();
		int min = t.length();
		for (int i = 0; i <= s.length()-t.length(); i++) {
			int change = t.length();
			for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i+j))
					change--;
			}
			min = Math.min(change, min);
		}
		System.out.println(min);
	} BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) String s = in.readLine(); s in.readLine() in.readLine in String t = in.readLine(); t in.readLine() in.readLine in int min = t.length(); min t.length() t.length t for (int i = 0; i <= s.length()-t.length(); i++) {
			int change = t.length();
			for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i+j))
					change--;
			}
			min = Math.min(change, min);
		} 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 change = t.length();
			for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i+j))
					change--;
			}
			min = Math.min(change, min);
		} {
			int change = t.length();
			for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i+j))
					change--;
			}
			min = Math.min(change, min);
		} int change = t.length(); change t.length() t.length t for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i+j))
					change--;
			} 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))
					change--;
			} {
				if (t.charAt(j) == s.charAt(i+j))
					change--;
			} if (t.charAt(j) == s.charAt(i+j))
					change--; 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 change-- change min = Math.min(change, min) min Math.min(change, min) Math.min Math change min System.out.println(min) System.out.println System.out System System.out min String[] args args public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s = in.readLine();
		String t = in.readLine();
		int min = t.length();
		for (int i = 0; i <= s.length()-t.length(); i++) {
			int change = t.length();
			for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i+j))
					change--;
			}
			min = Math.min(change, min);
		}
		System.out.println(min);
	}
} public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s = in.readLine();
		String t = in.readLine();
		int min = t.length();
		for (int i = 0; i <= s.length()-t.length(); i++) {
			int change = t.length();
			for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i+j))
					change--;
			}
			min = Math.min(change, min);
		}
		System.out.println(min);
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s = in.readLine();
		String t = in.readLine();
		int min = t.length();
		for (int i = 0; i <= s.length()-t.length(); i++) {
			int change = t.length();
			for (int j = 0; j < t.length(); j++) {
				if (t.charAt(j) == s.charAt(i+j))
					change--;
			}
			min = Math.min(change, min);
		}
		System.out.println(min);
	}
}
