import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	char[] S, T;

	Main(BufferedReader in) throws IOException {
		S = in.readLine().toCharArray();
		T = in.readLine().toCharArray();
	}

	int diff(int sStart) {
		int len = T.length;
		int result = 0;
		for (int i = sStart; i < sStart + len; ++i) {
			if (S[i] != T[i - sStart]) {
				++result;
			}
		}
		return result;
	}

	void calc() {
		int min = Integer.MAX_VALUE / 2;
		for (int i = 0; i + T.length <= S.length; ++i) {
			min = Math.min(min, diff(i));
		}
		System.out.println(min);
	}

	void showResult() {
	}
} import java.util.*; util.* java import java.io.*; io.* java import java.nio.charset.StandardCharsets; StandardCharsets java.nio.charset public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	char[] S, T;

	Main(BufferedReader in) throws IOException {
		S = in.readLine().toCharArray();
		T = in.readLine().toCharArray();
	}

	int diff(int sStart) {
		int len = T.length;
		int result = 0;
		for (int i = sStart; i < sStart + len; ++i) {
			if (S[i] != T[i - sStart]) {
				++result;
			}
		}
		return result;
	}

	void calc() {
		int min = Integer.MAX_VALUE / 2;
		for (int i = 0; i + T.length <= S.length; ++i) {
			min = Math.min(min, diff(i));
		}
		System.out.println(min);
	}

	void showResult() {
	}
} Main char[] S S T; T public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	} main {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	} InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8); reader new InputStreamReader(System.in, StandardCharsets.UTF_8) BufferedReader in = new BufferedReader(reader); in new BufferedReader(reader) Main ins = new Main(in); ins new Main(in) ins.calc() ins.calc ins ins.showResult() ins.showResult ins String[] args args Main(BufferedReader in) throws IOException {
		S = in.readLine().toCharArray();
		T = in.readLine().toCharArray();
	} Main {
		S = in.readLine().toCharArray();
		T = in.readLine().toCharArray();
	} S = in.readLine().toCharArray() S in.readLine().toCharArray() in.readLine().toCharArray in.readLine() in.readLine in T = in.readLine().toCharArray() T in.readLine().toCharArray() in.readLine().toCharArray in.readLine() in.readLine in BufferedReader in in int diff(int sStart) {
		int len = T.length;
		int result = 0;
		for (int i = sStart; i < sStart + len; ++i) {
			if (S[i] != T[i - sStart]) {
				++result;
			}
		}
		return result;
	} diff {
		int len = T.length;
		int result = 0;
		for (int i = sStart; i < sStart + len; ++i) {
			if (S[i] != T[i - sStart]) {
				++result;
			}
		}
		return result;
	} int len = T.length; len T.length T T.length int result = 0; result 0 for (int i = sStart; i < sStart + len; ++i) {
			if (S[i] != T[i - sStart]) {
				++result;
			}
		} int i = sStart; int i = sStart; i sStart i < sStart + len i sStart + len sStart len ++i ++i i {
			if (S[i] != T[i - sStart]) {
				++result;
			}
		} {
			if (S[i] != T[i - sStart]) {
				++result;
			}
		} if (S[i] != T[i - sStart]) {
				++result;
			} S[i] != T[i - sStart] S[i] S i T[i - sStart] T i - sStart i sStart {
				++result;
			} ++result result return result; result int sStart sStart void calc() {
		int min = Integer.MAX_VALUE / 2;
		for (int i = 0; i + T.length <= S.length; ++i) {
			min = Math.min(min, diff(i));
		}
		System.out.println(min);
	} calc {
		int min = Integer.MAX_VALUE / 2;
		for (int i = 0; i + T.length <= S.length; ++i) {
			min = Math.min(min, diff(i));
		}
		System.out.println(min);
	} int min = Integer.MAX_VALUE / 2; min Integer.MAX_VALUE / 2 Integer.MAX_VALUE Integer Integer.MAX_VALUE 2 for (int i = 0; i + T.length <= S.length; ++i) {
			min = Math.min(min, diff(i));
		} int i = 0; int i = 0; i 0 i + T.length <= S.length i + T.length i T.length T T.length S.length S S.length ++i ++i i {
			min = Math.min(min, diff(i));
		} {
			min = Math.min(min, diff(i));
		} min = Math.min(min, diff(i)) min Math.min(min, diff(i)) Math.min Math min diff(i) diff i System.out.println(min) System.out.println System.out System System.out min void showResult() {
	} showResult {
	} public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	char[] S, T;

	Main(BufferedReader in) throws IOException {
		S = in.readLine().toCharArray();
		T = in.readLine().toCharArray();
	}

	int diff(int sStart) {
		int len = T.length;
		int result = 0;
		for (int i = sStart; i < sStart + len; ++i) {
			if (S[i] != T[i - sStart]) {
				++result;
			}
		}
		return result;
	}

	void calc() {
		int min = Integer.MAX_VALUE / 2;
		for (int i = 0; i + T.length <= S.length; ++i) {
			min = Math.min(min, diff(i));
		}
		System.out.println(min);
	}

	void showResult() {
	}
} public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	char[] S, T;

	Main(BufferedReader in) throws IOException {
		S = in.readLine().toCharArray();
		T = in.readLine().toCharArray();
	}

	int diff(int sStart) {
		int len = T.length;
		int result = 0;
		for (int i = sStart; i < sStart + len; ++i) {
			if (S[i] != T[i - sStart]) {
				++result;
			}
		}
		return result;
	}

	void calc() {
		int min = Integer.MAX_VALUE / 2;
		for (int i = 0; i + T.length <= S.length; ++i) {
			min = Math.min(min, diff(i));
		}
		System.out.println(min);
	}

	void showResult() {
	}
} Main
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	char[] S, T;

	Main(BufferedReader in) throws IOException {
		S = in.readLine().toCharArray();
		T = in.readLine().toCharArray();
	}

	int diff(int sStart) {
		int len = T.length;
		int result = 0;
		for (int i = sStart; i < sStart + len; ++i) {
			if (S[i] != T[i - sStart]) {
				++result;
			}
		}
		return result;
	}

	void calc() {
		int min = Integer.MAX_VALUE / 2;
		for (int i = 0; i + T.length <= S.length; ++i) {
			min = Math.min(min, diff(i));
		}
		System.out.println(min);
	}

	void showResult() {
	}
}