import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author lucasr
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		MyScanner in = new MyScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		BSubstring solver = new BSubstring();
		solver.solve(1, in, out);
		out.close();
	}

	static class BSubstring {
		public void solve(int testNumber, MyScanner sc, PrintWriter out) {
			char[] S = sc.next().toCharArray();
			char[] T = sc.next().toCharArray();
			int ans = T.length;

			for (int i = 0; i + T.length <= S.length; i++) {
				int tmp = 0;
				for (int j = 0; j < T.length; j++) {
					if (T[j] != S[i + j]) tmp++;
				}
				ans = Math.min(ans, tmp);
			}

			out.println(ans);
		}

	}

	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;

		public MyScanner(InputStream is) {
			br = new BufferedReader(new InputStreamReader(is));
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

	}
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.StringTokenizer; StringTokenizer java.util import java.io.IOException; IOException java.io import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.InputStream; InputStream java.io public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		MyScanner in = new MyScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		BSubstring solver = new BSubstring();
		solver.solve(1, in, out);
		out.close();
	}

	static class BSubstring {
		public void solve(int testNumber, MyScanner sc, PrintWriter out) {
			char[] S = sc.next().toCharArray();
			char[] T = sc.next().toCharArray();
			int ans = T.length;

			for (int i = 0; i + T.length <= S.length; i++) {
				int tmp = 0;
				for (int j = 0; j < T.length; j++) {
					if (T[j] != S[i + j]) tmp++;
				}
				ans = Math.min(ans, tmp);
			}

			out.println(ans);
		}

	}

	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;

		public MyScanner(InputStream is) {
			br = new BufferedReader(new InputStreamReader(is));
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

	}
} Main public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		MyScanner in = new MyScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		BSubstring solver = new BSubstring();
		solver.solve(1, in, out);
		out.close();
	} main {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		MyScanner in = new MyScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		BSubstring solver = new BSubstring();
		solver.solve(1, in, out);
		out.close();
	} InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out MyScanner in = new MyScanner(inputStream); in new MyScanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) BSubstring solver = new BSubstring(); solver new BSubstring() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class BSubstring {
		public void solve(int testNumber, MyScanner sc, PrintWriter out) {
			char[] S = sc.next().toCharArray();
			char[] T = sc.next().toCharArray();
			int ans = T.length;

			for (int i = 0; i + T.length <= S.length; i++) {
				int tmp = 0;
				for (int j = 0; j < T.length; j++) {
					if (T[j] != S[i + j]) tmp++;
				}
				ans = Math.min(ans, tmp);
			}

			out.println(ans);
		}

	} BSubstring public void solve(int testNumber, MyScanner sc, PrintWriter out) {
			char[] S = sc.next().toCharArray();
			char[] T = sc.next().toCharArray();
			int ans = T.length;

			for (int i = 0; i + T.length <= S.length; i++) {
				int tmp = 0;
				for (int j = 0; j < T.length; j++) {
					if (T[j] != S[i + j]) tmp++;
				}
				ans = Math.min(ans, tmp);
			}

			out.println(ans);
		} solve {
			char[] S = sc.next().toCharArray();
			char[] T = sc.next().toCharArray();
			int ans = T.length;

			for (int i = 0; i + T.length <= S.length; i++) {
				int tmp = 0;
				for (int j = 0; j < T.length; j++) {
					if (T[j] != S[i + j]) tmp++;
				}
				ans = Math.min(ans, tmp);
			}

			out.println(ans);
		} char[] S = sc.next().toCharArray(); S sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc char[] T = sc.next().toCharArray(); T sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc int ans = T.length; ans T.length T T.length for (int i = 0; i + T.length <= S.length; i++) {
				int tmp = 0;
				for (int j = 0; j < T.length; j++) {
					if (T[j] != S[i + j]) tmp++;
				}
				ans = Math.min(ans, tmp);
			} 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 {
				int tmp = 0;
				for (int j = 0; j < T.length; j++) {
					if (T[j] != S[i + j]) tmp++;
				}
				ans = Math.min(ans, tmp);
			} {
				int tmp = 0;
				for (int j = 0; j < T.length; j++) {
					if (T[j] != S[i + j]) tmp++;
				}
				ans = Math.min(ans, tmp);
			} int tmp = 0; tmp 0 for (int j = 0; j < T.length; j++) {
					if (T[j] != S[i + j]) tmp++;
				} int j = 0; int j = 0; j 0 j < T.length j T.length T T.length j++ j++ j {
					if (T[j] != S[i + j]) tmp++;
				} {
					if (T[j] != S[i + j]) tmp++;
				} if (T[j] != S[i + j]) tmp++; T[j] != S[i + j] T[j] T j S[i + j] S i + j i j tmp++ tmp ans = Math.min(ans, tmp) ans Math.min(ans, tmp) Math.min Math ans tmp out.println(ans) out.println out ans int testNumber testNumber MyScanner sc sc PrintWriter out out static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;

		public MyScanner(InputStream is) {
			br = new BufferedReader(new InputStreamReader(is));
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

	} MyScanner private BufferedReader br; br private StringTokenizer tokenizer; tokenizer public MyScanner(InputStream is) {
			br = new BufferedReader(new InputStreamReader(is));
		} MyScanner {
			br = new BufferedReader(new InputStreamReader(is));
		} br = new BufferedReader(new InputStreamReader(is)) br new BufferedReader(new InputStreamReader(is)) InputStream is is public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		} next {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		} while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			} tokenizer == null || !tokenizer.hasMoreTokens() tokenizer == null tokenizer null !tokenizer.hasMoreTokens() tokenizer.hasMoreTokens() tokenizer.hasMoreTokens tokenizer {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			} try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				} catch (IOException e) {
					throw new RuntimeException(e);
				} IOException e {
					throw new RuntimeException(e);
				} throw new RuntimeException(e); new RuntimeException(e) {
					tokenizer = new StringTokenizer(br.readLine());
				} tokenizer = new StringTokenizer(br.readLine()) tokenizer new StringTokenizer(br.readLine()) return tokenizer.nextToken(); tokenizer.nextToken() tokenizer.nextToken tokenizer public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		MyScanner in = new MyScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		BSubstring solver = new BSubstring();
		solver.solve(1, in, out);
		out.close();
	}

	static class BSubstring {
		public void solve(int testNumber, MyScanner sc, PrintWriter out) {
			char[] S = sc.next().toCharArray();
			char[] T = sc.next().toCharArray();
			int ans = T.length;

			for (int i = 0; i + T.length <= S.length; i++) {
				int tmp = 0;
				for (int j = 0; j < T.length; j++) {
					if (T[j] != S[i + j]) tmp++;
				}
				ans = Math.min(ans, tmp);
			}

			out.println(ans);
		}

	}

	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;

		public MyScanner(InputStream is) {
			br = new BufferedReader(new InputStreamReader(is));
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

	}
} public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		MyScanner in = new MyScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		BSubstring solver = new BSubstring();
		solver.solve(1, in, out);
		out.close();
	}

	static class BSubstring {
		public void solve(int testNumber, MyScanner sc, PrintWriter out) {
			char[] S = sc.next().toCharArray();
			char[] T = sc.next().toCharArray();
			int ans = T.length;

			for (int i = 0; i + T.length <= S.length; i++) {
				int tmp = 0;
				for (int j = 0; j < T.length; j++) {
					if (T[j] != S[i + j]) tmp++;
				}
				ans = Math.min(ans, tmp);
			}

			out.println(ans);
		}

	}

	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;

		public MyScanner(InputStream is) {
			br = new BufferedReader(new InputStreamReader(is));
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

	}
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author lucasr
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		MyScanner in = new MyScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		BSubstring solver = new BSubstring();
		solver.solve(1, in, out);
		out.close();
	}

	static class BSubstring {
		public void solve(int testNumber, MyScanner sc, PrintWriter out) {
			char[] S = sc.next().toCharArray();
			char[] T = sc.next().toCharArray();
			int ans = T.length;

			for (int i = 0; i + T.length <= S.length; i++) {
				int tmp = 0;
				for (int j = 0; j < T.length; j++) {
					if (T[j] != S[i + j]) tmp++;
				}
				ans = Math.min(ans, tmp);
			}

			out.println(ans);
		}

	}

	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;

		public MyScanner(InputStream is) {
			br = new BufferedReader(new InputStreamReader(is));
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

	}
}

