import java.util.*;

public class Main {
	static Scanner scan = new Scanner(System.in);
	
	public static void main(String[] args) {
		String s = scan.next();
		String t = scan.next();
		int ans = t.length();
		
		for(int i=0;i<=s.length()-t.length();i++) {
			int now_ans = t.length();
			for(int j=0;j<t.length();j++) {
				if(s.charAt(i+j) == t.charAt(j)) {
					now_ans--;
				}
			}
			ans = Math.min(ans, now_ans);
		}
		
		System.out.println(ans);
		
		
		
		
	}
	
	
	public static int gcd(int x,int y) {
		if(x%y == 0) {
			return y;
		}else {
			return gcd(y,x%y);
		}
	}
}
 


 import java.util.*; util.* java public class Main {
	static Scanner scan = new Scanner(System.in);
	
	public static void main(String[] args) {
		String s = scan.next();
		String t = scan.next();
		int ans = t.length();
		
		for(int i=0;i<=s.length()-t.length();i++) {
			int now_ans = t.length();
			for(int j=0;j<t.length();j++) {
				if(s.charAt(i+j) == t.charAt(j)) {
					now_ans--;
				}
			}
			ans = Math.min(ans, now_ans);
		}
		
		System.out.println(ans);
		
		
		
		
	}
	
	
	public static int gcd(int x,int y) {
		if(x%y == 0) {
			return y;
		}else {
			return gcd(y,x%y);
		}
	}
} Main static Scanner scan = new Scanner(System.in); scan new Scanner(System.in) public static void main(String[] args) {
		String s = scan.next();
		String t = scan.next();
		int ans = t.length();
		
		for(int i=0;i<=s.length()-t.length();i++) {
			int now_ans = t.length();
			for(int j=0;j<t.length();j++) {
				if(s.charAt(i+j) == t.charAt(j)) {
					now_ans--;
				}
			}
			ans = Math.min(ans, now_ans);
		}
		
		System.out.println(ans);
		
		
		
		
	} main {
		String s = scan.next();
		String t = scan.next();
		int ans = t.length();
		
		for(int i=0;i<=s.length()-t.length();i++) {
			int now_ans = t.length();
			for(int j=0;j<t.length();j++) {
				if(s.charAt(i+j) == t.charAt(j)) {
					now_ans--;
				}
			}
			ans = Math.min(ans, now_ans);
		}
		
		System.out.println(ans);
		
		
		
		
	} String s = scan.next(); s scan.next() scan.next scan String t = scan.next(); t scan.next() scan.next scan int ans = t.length(); ans t.length() t.length t for(int i=0;i<=s.length()-t.length();i++) {
			int now_ans = t.length();
			for(int j=0;j<t.length();j++) {
				if(s.charAt(i+j) == t.charAt(j)) {
					now_ans--;
				}
			}
			ans = Math.min(ans, now_ans);
		} 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 now_ans = t.length();
			for(int j=0;j<t.length();j++) {
				if(s.charAt(i+j) == t.charAt(j)) {
					now_ans--;
				}
			}
			ans = Math.min(ans, now_ans);
		} {
			int now_ans = t.length();
			for(int j=0;j<t.length();j++) {
				if(s.charAt(i+j) == t.charAt(j)) {
					now_ans--;
				}
			}
			ans = Math.min(ans, now_ans);
		} int now_ans = t.length(); now_ans t.length() t.length t for(int j=0;j<t.length();j++) {
				if(s.charAt(i+j) == t.charAt(j)) {
					now_ans--;
				}
			} int j=0; int j=0; j 0 j<t.length() j t.length() t.length t j++ j++ j {
				if(s.charAt(i+j) == t.charAt(j)) {
					now_ans--;
				}
			} {
				if(s.charAt(i+j) == t.charAt(j)) {
					now_ans--;
				}
			} if(s.charAt(i+j) == t.charAt(j)) {
					now_ans--;
				} s.charAt(i+j) == t.charAt(j) s.charAt(i+j) s.charAt s i+j i j t.charAt(j) t.charAt t j {
					now_ans--;
				} now_ans-- now_ans ans = Math.min(ans, now_ans) ans Math.min(ans, now_ans) Math.min Math ans now_ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args public static int gcd(int x,int y) {
		if(x%y == 0) {
			return y;
		}else {
			return gcd(y,x%y);
		}
	} gcd {
		if(x%y == 0) {
			return y;
		}else {
			return gcd(y,x%y);
		}
	} if(x%y == 0) {
			return y;
		}else {
			return gcd(y,x%y);
		} x%y == 0 x%y x y 0 {
			return y;
		} return y; y {
			return gcd(y,x%y);
		} return gcd(y,x%y); gcd(y,x%y) gcd y x%y x y int x x int y y public class Main {
	static Scanner scan = new Scanner(System.in);
	
	public static void main(String[] args) {
		String s = scan.next();
		String t = scan.next();
		int ans = t.length();
		
		for(int i=0;i<=s.length()-t.length();i++) {
			int now_ans = t.length();
			for(int j=0;j<t.length();j++) {
				if(s.charAt(i+j) == t.charAt(j)) {
					now_ans--;
				}
			}
			ans = Math.min(ans, now_ans);
		}
		
		System.out.println(ans);
		
		
		
		
	}
	
	
	public static int gcd(int x,int y) {
		if(x%y == 0) {
			return y;
		}else {
			return gcd(y,x%y);
		}
	}
} public class Main {
	static Scanner scan = new Scanner(System.in);
	
	public static void main(String[] args) {
		String s = scan.next();
		String t = scan.next();
		int ans = t.length();
		
		for(int i=0;i<=s.length()-t.length();i++) {
			int now_ans = t.length();
			for(int j=0;j<t.length();j++) {
				if(s.charAt(i+j) == t.charAt(j)) {
					now_ans--;
				}
			}
			ans = Math.min(ans, now_ans);
		}
		
		System.out.println(ans);
		
		
		
		
	}
	
	
	public static int gcd(int x,int y) {
		if(x%y == 0) {
			return y;
		}else {
			return gcd(y,x%y);
		}
	}
} Main
import java.util.*;

public class Main {
	static Scanner scan = new Scanner(System.in);
	
	public static void main(String[] args) {
		String s = scan.next();
		String t = scan.next();
		int ans = t.length();
		
		for(int i=0;i<=s.length()-t.length();i++) {
			int now_ans = t.length();
			for(int j=0;j<t.length();j++) {
				if(s.charAt(i+j) == t.charAt(j)) {
					now_ans--;
				}
			}
			ans = Math.min(ans, now_ans);
		}
		
		System.out.println(ans);
		
		
		
		
	}
	
	
	public static int gcd(int x,int y) {
		if(x%y == 0) {
			return y;
		}else {
			return gcd(y,x%y);
		}
	}
}
 



