import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		char[] cs = new char[s.length()];
		char[] ct = new char[t.length()];
		boolean[] count = new boolean[1001];
		int max = 0;
		
		for(int i=0;i<s.length();i++) {
			cs[i] = s.charAt(i);
		}
		
		for(int i=0;i<t.length();i++) {
			ct[i] = t.charAt(i);
		}
		
		for(int i=0;i<=s.length()-t.length();i++) {
			int n = 0;
			for(int j=0;j<t.length();j++) {
				if(cs[i+j] == ct[j]) {
					n++;
				}
			}
			max = Math.max(max, n);
			count[n] = true;
		}
		
		System.out.println(t.length()-max);

	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		char[] cs = new char[s.length()];
		char[] ct = new char[t.length()];
		boolean[] count = new boolean[1001];
		int max = 0;
		
		for(int i=0;i<s.length();i++) {
			cs[i] = s.charAt(i);
		}
		
		for(int i=0;i<t.length();i++) {
			ct[i] = t.charAt(i);
		}
		
		for(int i=0;i<=s.length()-t.length();i++) {
			int n = 0;
			for(int j=0;j<t.length();j++) {
				if(cs[i+j] == ct[j]) {
					n++;
				}
			}
			max = Math.max(max, n);
			count[n] = true;
		}
		
		System.out.println(t.length()-max);

	}

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		char[] cs = new char[s.length()];
		char[] ct = new char[t.length()];
		boolean[] count = new boolean[1001];
		int max = 0;
		
		for(int i=0;i<s.length();i++) {
			cs[i] = s.charAt(i);
		}
		
		for(int i=0;i<t.length();i++) {
			ct[i] = t.charAt(i);
		}
		
		for(int i=0;i<=s.length()-t.length();i++) {
			int n = 0;
			for(int j=0;j<t.length();j++) {
				if(cs[i+j] == ct[j]) {
					n++;
				}
			}
			max = Math.max(max, n);
			count[n] = true;
		}
		
		System.out.println(t.length()-max);

	} main {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		char[] cs = new char[s.length()];
		char[] ct = new char[t.length()];
		boolean[] count = new boolean[1001];
		int max = 0;
		
		for(int i=0;i<s.length();i++) {
			cs[i] = s.charAt(i);
		}
		
		for(int i=0;i<t.length();i++) {
			ct[i] = t.charAt(i);
		}
		
		for(int i=0;i<=s.length()-t.length();i++) {
			int n = 0;
			for(int j=0;j<t.length();j++) {
				if(cs[i+j] == ct[j]) {
					n++;
				}
			}
			max = Math.max(max, n);
			count[n] = true;
		}
		
		System.out.println(t.length()-max);

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan String t = scan.next(); t scan.next() scan.next scan char[] cs = new char[s.length()]; cs new char[s.length()] s.length() s.length s char[] ct = new char[t.length()]; ct new char[t.length()] t.length() t.length t boolean[] count = new boolean[1001]; count new boolean[1001] 1001 int max = 0; max 0 for(int i=0;i<s.length();i++) {
			cs[i] = s.charAt(i);
		} int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
			cs[i] = s.charAt(i);
		} {
			cs[i] = s.charAt(i);
		} cs[i] = s.charAt(i) cs[i] cs i s.charAt(i) s.charAt s i for(int i=0;i<t.length();i++) {
			ct[i] = t.charAt(i);
		} int i=0; int i=0; i 0 i<t.length() i t.length() t.length t i++ i++ i {
			ct[i] = t.charAt(i);
		} {
			ct[i] = t.charAt(i);
		} ct[i] = t.charAt(i) ct[i] ct i t.charAt(i) t.charAt t i for(int i=0;i<=s.length()-t.length();i++) {
			int n = 0;
			for(int j=0;j<t.length();j++) {
				if(cs[i+j] == ct[j]) {
					n++;
				}
			}
			max = Math.max(max, n);
			count[n] = true;
		} 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 n = 0;
			for(int j=0;j<t.length();j++) {
				if(cs[i+j] == ct[j]) {
					n++;
				}
			}
			max = Math.max(max, n);
			count[n] = true;
		} {
			int n = 0;
			for(int j=0;j<t.length();j++) {
				if(cs[i+j] == ct[j]) {
					n++;
				}
			}
			max = Math.max(max, n);
			count[n] = true;
		} int n = 0; n 0 for(int j=0;j<t.length();j++) {
				if(cs[i+j] == ct[j]) {
					n++;
				}
			} int j=0; int j=0; j 0 j<t.length() j t.length() t.length t j++ j++ j {
				if(cs[i+j] == ct[j]) {
					n++;
				}
			} {
				if(cs[i+j] == ct[j]) {
					n++;
				}
			} if(cs[i+j] == ct[j]) {
					n++;
				} cs[i+j] == ct[j] cs[i+j] cs i+j i j ct[j] ct j {
					n++;
				} n++ n max = Math.max(max, n) max Math.max(max, n) Math.max Math max n count[n] = true count[n] count n true System.out.println(t.length()-max) System.out.println System.out System System.out t.length()-max t.length() t.length t max String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		char[] cs = new char[s.length()];
		char[] ct = new char[t.length()];
		boolean[] count = new boolean[1001];
		int max = 0;
		
		for(int i=0;i<s.length();i++) {
			cs[i] = s.charAt(i);
		}
		
		for(int i=0;i<t.length();i++) {
			ct[i] = t.charAt(i);
		}
		
		for(int i=0;i<=s.length()-t.length();i++) {
			int n = 0;
			for(int j=0;j<t.length();j++) {
				if(cs[i+j] == ct[j]) {
					n++;
				}
			}
			max = Math.max(max, n);
			count[n] = true;
		}
		
		System.out.println(t.length()-max);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		char[] cs = new char[s.length()];
		char[] ct = new char[t.length()];
		boolean[] count = new boolean[1001];
		int max = 0;
		
		for(int i=0;i<s.length();i++) {
			cs[i] = s.charAt(i);
		}
		
		for(int i=0;i<t.length();i++) {
			ct[i] = t.charAt(i);
		}
		
		for(int i=0;i<=s.length()-t.length();i++) {
			int n = 0;
			for(int j=0;j<t.length();j++) {
				if(cs[i+j] == ct[j]) {
					n++;
				}
			}
			max = Math.max(max, n);
			count[n] = true;
		}
		
		System.out.println(t.length()-max);

	}

} Main
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		char[] cs = new char[s.length()];
		char[] ct = new char[t.length()];
		boolean[] count = new boolean[1001];
		int max = 0;
		
		for(int i=0;i<s.length();i++) {
			cs[i] = s.charAt(i);
		}
		
		for(int i=0;i<t.length();i++) {
			ct[i] = t.charAt(i);
		}
		
		for(int i=0;i<=s.length()-t.length();i++) {
			int n = 0;
			for(int j=0;j<t.length();j++) {
				if(cs[i+j] == ct[j]) {
					n++;
				}
			}
			max = Math.max(max, n);
			count[n] = true;
		}
		
		System.out.println(t.length()-max);

	}

}