import java.util.ArrayList;
import java.util.Scanner;

 
public class Main {
 
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		String s  = sc.nextLine();
		char[] sChars = s.toCharArray();
		String t  = sc.nextLine();
		char[] tChars = t.toCharArray();
		int max = 0;
		
		for(int i = 0; i <= s.length() - t.length(); i++) {
			
			int matchChar = 0;
			for(int j = 0; j < t.length(); j++) {
				if(tChars[j] == sChars[i+j]) {
						matchChar++;
				}
			}

			if(max < matchChar) {
				max = matchChar;
			}
			
		}


		System.out.println(t.length() - max);
		sc.close();
	}
}

 import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {
 
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		String s  = sc.nextLine();
		char[] sChars = s.toCharArray();
		String t  = sc.nextLine();
		char[] tChars = t.toCharArray();
		int max = 0;
		
		for(int i = 0; i <= s.length() - t.length(); i++) {
			
			int matchChar = 0;
			for(int j = 0; j < t.length(); j++) {
				if(tChars[j] == sChars[i+j]) {
						matchChar++;
				}
			}

			if(max < matchChar) {
				max = matchChar;
			}
			
		}


		System.out.println(t.length() - max);
		sc.close();
	}
} Main public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		String s  = sc.nextLine();
		char[] sChars = s.toCharArray();
		String t  = sc.nextLine();
		char[] tChars = t.toCharArray();
		int max = 0;
		
		for(int i = 0; i <= s.length() - t.length(); i++) {
			
			int matchChar = 0;
			for(int j = 0; j < t.length(); j++) {
				if(tChars[j] == sChars[i+j]) {
						matchChar++;
				}
			}

			if(max < matchChar) {
				max = matchChar;
			}
			
		}


		System.out.println(t.length() - max);
		sc.close();
	} main {
		
		Scanner sc = new Scanner(System.in);
		String s  = sc.nextLine();
		char[] sChars = s.toCharArray();
		String t  = sc.nextLine();
		char[] tChars = t.toCharArray();
		int max = 0;
		
		for(int i = 0; i <= s.length() - t.length(); i++) {
			
			int matchChar = 0;
			for(int j = 0; j < t.length(); j++) {
				if(tChars[j] == sChars[i+j]) {
						matchChar++;
				}
			}

			if(max < matchChar) {
				max = matchChar;
			}
			
		}


		System.out.println(t.length() - max);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s  = sc.nextLine(); s sc.nextLine() sc.nextLine sc char[] sChars = s.toCharArray(); sChars s.toCharArray() s.toCharArray s String t  = sc.nextLine(); t sc.nextLine() sc.nextLine sc char[] tChars = t.toCharArray(); tChars t.toCharArray() t.toCharArray t int max = 0; max 0 for(int i = 0; i <= s.length() - t.length(); i++) {
			
			int matchChar = 0;
			for(int j = 0; j < t.length(); j++) {
				if(tChars[j] == sChars[i+j]) {
						matchChar++;
				}
			}

			if(max < matchChar) {
				max = matchChar;
			}
			
		} 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 matchChar = 0;
			for(int j = 0; j < t.length(); j++) {
				if(tChars[j] == sChars[i+j]) {
						matchChar++;
				}
			}

			if(max < matchChar) {
				max = matchChar;
			}
			
		} {
			
			int matchChar = 0;
			for(int j = 0; j < t.length(); j++) {
				if(tChars[j] == sChars[i+j]) {
						matchChar++;
				}
			}

			if(max < matchChar) {
				max = matchChar;
			}
			
		} int matchChar = 0; matchChar 0 for(int j = 0; j < t.length(); j++) {
				if(tChars[j] == sChars[i+j]) {
						matchChar++;
				}
			} int j = 0; int j = 0; j 0 j < t.length() j t.length() t.length t j++ j++ j {
				if(tChars[j] == sChars[i+j]) {
						matchChar++;
				}
			} {
				if(tChars[j] == sChars[i+j]) {
						matchChar++;
				}
			} if(tChars[j] == sChars[i+j]) {
						matchChar++;
				} tChars[j] == sChars[i+j] tChars[j] tChars j sChars[i+j] sChars i+j i j {
						matchChar++;
				} matchChar++ matchChar if(max < matchChar) {
				max = matchChar;
			} max < matchChar max matchChar {
				max = matchChar;
			} max = matchChar max matchChar System.out.println(t.length() - max) System.out.println System.out System System.out t.length() - max t.length() t.length t max sc.close() sc.close sc String[] args args public class Main {
 
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		String s  = sc.nextLine();
		char[] sChars = s.toCharArray();
		String t  = sc.nextLine();
		char[] tChars = t.toCharArray();
		int max = 0;
		
		for(int i = 0; i <= s.length() - t.length(); i++) {
			
			int matchChar = 0;
			for(int j = 0; j < t.length(); j++) {
				if(tChars[j] == sChars[i+j]) {
						matchChar++;
				}
			}

			if(max < matchChar) {
				max = matchChar;
			}
			
		}


		System.out.println(t.length() - max);
		sc.close();
	}
} public class Main {
 
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		String s  = sc.nextLine();
		char[] sChars = s.toCharArray();
		String t  = sc.nextLine();
		char[] tChars = t.toCharArray();
		int max = 0;
		
		for(int i = 0; i <= s.length() - t.length(); i++) {
			
			int matchChar = 0;
			for(int j = 0; j < t.length(); j++) {
				if(tChars[j] == sChars[i+j]) {
						matchChar++;
				}
			}

			if(max < matchChar) {
				max = matchChar;
			}
			
		}


		System.out.println(t.length() - max);
		sc.close();
	}
} Main
import java.util.ArrayList;
import java.util.Scanner;

 
public class Main {
 
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		String s  = sc.nextLine();
		char[] sChars = s.toCharArray();
		String t  = sc.nextLine();
		char[] tChars = t.toCharArray();
		int max = 0;
		
		for(int i = 0; i <= s.length() - t.length(); i++) {
			
			int matchChar = 0;
			for(int j = 0; j < t.length(); j++) {
				if(tChars[j] == sChars[i+j]) {
						matchChar++;
				}
			}

			if(max < matchChar) {
				max = matchChar;
			}
			
		}


		System.out.println(t.length() - max);
		sc.close();
	}
}


