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

public class Main {


	public static void main(String[] args) throws IOException {
		BufferedReader bf = null;
		bf = new BufferedReader(new InputStreamReader(System.in));
		int ans = 10000,temp = 0;
		String s,t;
		String str;
		str = bf.readLine();
		s = str;
		str = bf.readLine();
		t = str;
		for(int i = 0;i < s.length()-t.length()+1;++i) {
			temp = 0;
			for(int j = 0;j < t.length();++j) {
				if(!s.substring(i+j, i+j+1).equals(t.substring(j, j+1))) {
					temp++;
				}
			}
			if(ans > temp) {
				ans = temp;
			}
		}
		System.out.println(ans);
	}
} 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 bf = null;
		bf = new BufferedReader(new InputStreamReader(System.in));
		int ans = 10000,temp = 0;
		String s,t;
		String str;
		str = bf.readLine();
		s = str;
		str = bf.readLine();
		t = str;
		for(int i = 0;i < s.length()-t.length()+1;++i) {
			temp = 0;
			for(int j = 0;j < t.length();++j) {
				if(!s.substring(i+j, i+j+1).equals(t.substring(j, j+1))) {
					temp++;
				}
			}
			if(ans > temp) {
				ans = temp;
			}
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader bf = null;
		bf = new BufferedReader(new InputStreamReader(System.in));
		int ans = 10000,temp = 0;
		String s,t;
		String str;
		str = bf.readLine();
		s = str;
		str = bf.readLine();
		t = str;
		for(int i = 0;i < s.length()-t.length()+1;++i) {
			temp = 0;
			for(int j = 0;j < t.length();++j) {
				if(!s.substring(i+j, i+j+1).equals(t.substring(j, j+1))) {
					temp++;
				}
			}
			if(ans > temp) {
				ans = temp;
			}
		}
		System.out.println(ans);
	} main {
		BufferedReader bf = null;
		bf = new BufferedReader(new InputStreamReader(System.in));
		int ans = 10000,temp = 0;
		String s,t;
		String str;
		str = bf.readLine();
		s = str;
		str = bf.readLine();
		t = str;
		for(int i = 0;i < s.length()-t.length()+1;++i) {
			temp = 0;
			for(int j = 0;j < t.length();++j) {
				if(!s.substring(i+j, i+j+1).equals(t.substring(j, j+1))) {
					temp++;
				}
			}
			if(ans > temp) {
				ans = temp;
			}
		}
		System.out.println(ans);
	} BufferedReader bf = null; bf null bf = new BufferedReader(new InputStreamReader(System.in)) bf new BufferedReader(new InputStreamReader(System.in)) int ans = 10000 ans 10000 temp = 0; temp 0 String s s t; t String str; str str = bf.readLine() str bf.readLine() bf.readLine bf s = str s str str = bf.readLine() str bf.readLine() bf.readLine bf t = str t str for(int i = 0;i < s.length()-t.length()+1;++i) {
			temp = 0;
			for(int j = 0;j < t.length();++j) {
				if(!s.substring(i+j, i+j+1).equals(t.substring(j, j+1))) {
					temp++;
				}
			}
			if(ans > temp) {
				ans = temp;
			}
		} int i = 0; int i = 0; i 0 i < s.length()-t.length()+1 i s.length()-t.length()+1 s.length()-t.length() s.length() s.length s t.length() t.length t 1 ++i ++i i {
			temp = 0;
			for(int j = 0;j < t.length();++j) {
				if(!s.substring(i+j, i+j+1).equals(t.substring(j, j+1))) {
					temp++;
				}
			}
			if(ans > temp) {
				ans = temp;
			}
		} {
			temp = 0;
			for(int j = 0;j < t.length();++j) {
				if(!s.substring(i+j, i+j+1).equals(t.substring(j, j+1))) {
					temp++;
				}
			}
			if(ans > temp) {
				ans = temp;
			}
		} temp = 0 temp 0 for(int j = 0;j < t.length();++j) {
				if(!s.substring(i+j, i+j+1).equals(t.substring(j, j+1))) {
					temp++;
				}
			} int j = 0; int j = 0; j 0 j < t.length() j t.length() t.length t ++j ++j j {
				if(!s.substring(i+j, i+j+1).equals(t.substring(j, j+1))) {
					temp++;
				}
			} {
				if(!s.substring(i+j, i+j+1).equals(t.substring(j, j+1))) {
					temp++;
				}
			} if(!s.substring(i+j, i+j+1).equals(t.substring(j, j+1))) {
					temp++;
				} !s.substring(i+j, i+j+1).equals(t.substring(j, j+1)) s.substring(i+j, i+j+1).equals(t.substring(j, j+1)) s.substring(i+j, i+j+1).equals s.substring(i+j, i+j+1) s.substring s i+j i j i+j+1 i+j+1 i j 1 t.substring(j, j+1) t.substring t j j+1 j 1 {
					temp++;
				} temp++ temp if(ans > temp) {
				ans = temp;
			} ans > temp ans temp {
				ans = temp;
			} ans = temp ans temp System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {


	public static void main(String[] args) throws IOException {
		BufferedReader bf = null;
		bf = new BufferedReader(new InputStreamReader(System.in));
		int ans = 10000,temp = 0;
		String s,t;
		String str;
		str = bf.readLine();
		s = str;
		str = bf.readLine();
		t = str;
		for(int i = 0;i < s.length()-t.length()+1;++i) {
			temp = 0;
			for(int j = 0;j < t.length();++j) {
				if(!s.substring(i+j, i+j+1).equals(t.substring(j, j+1))) {
					temp++;
				}
			}
			if(ans > temp) {
				ans = temp;
			}
		}
		System.out.println(ans);
	}
} public class Main {


	public static void main(String[] args) throws IOException {
		BufferedReader bf = null;
		bf = new BufferedReader(new InputStreamReader(System.in));
		int ans = 10000,temp = 0;
		String s,t;
		String str;
		str = bf.readLine();
		s = str;
		str = bf.readLine();
		t = str;
		for(int i = 0;i < s.length()-t.length()+1;++i) {
			temp = 0;
			for(int j = 0;j < t.length();++j) {
				if(!s.substring(i+j, i+j+1).equals(t.substring(j, j+1))) {
					temp++;
				}
			}
			if(ans > temp) {
				ans = temp;
			}
		}
		System.out.println(ans);
	}
} 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 bf = null;
		bf = new BufferedReader(new InputStreamReader(System.in));
		int ans = 10000,temp = 0;
		String s,t;
		String str;
		str = bf.readLine();
		s = str;
		str = bf.readLine();
		t = str;
		for(int i = 0;i < s.length()-t.length()+1;++i) {
			temp = 0;
			for(int j = 0;j < t.length();++j) {
				if(!s.substring(i+j, i+j+1).equals(t.substring(j, j+1))) {
					temp++;
				}
			}
			if(ans > temp) {
				ans = temp;
			}
		}
		System.out.println(ans);
	}
}