import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {
			
			String s = sc.next();
			String t = sc.next();
			
			
			char[] sChar = s.toCharArray();
			char[] tChar = t.toCharArray();
			
			int len = tChar.length;
			for(int i = 0 ; i < s.length() - t.length() + 1; i++ ) {
				
				int cLen = 0;
				for(int j = 0 ; j < t.length() ; j++ ) {
					if ( sChar[i+j] != tChar[j]) {
						cLen++;
					}
					
				}
				
				if ( cLen < len ) {
					len = cLen;
				}
			}
			
			System.out.println(len);
		
		}
	}

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {
			
			String s = sc.next();
			String t = sc.next();
			
			
			char[] sChar = s.toCharArray();
			char[] tChar = t.toCharArray();
			
			int len = tChar.length;
			for(int i = 0 ; i < s.length() - t.length() + 1; i++ ) {
				
				int cLen = 0;
				for(int j = 0 ; j < t.length() ; j++ ) {
					if ( sChar[i+j] != tChar[j]) {
						cLen++;
					}
					
				}
				
				if ( cLen < len ) {
					len = cLen;
				}
			}
			
			System.out.println(len);
		
		}
	}

} Main public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {
			
			String s = sc.next();
			String t = sc.next();
			
			
			char[] sChar = s.toCharArray();
			char[] tChar = t.toCharArray();
			
			int len = tChar.length;
			for(int i = 0 ; i < s.length() - t.length() + 1; i++ ) {
				
				int cLen = 0;
				for(int j = 0 ; j < t.length() ; j++ ) {
					if ( sChar[i+j] != tChar[j]) {
						cLen++;
					}
					
				}
				
				if ( cLen < len ) {
					len = cLen;
				}
			}
			
			System.out.println(len);
		
		}
	} main {
		try(Scanner sc = new Scanner(System.in)) {
			
			String s = sc.next();
			String t = sc.next();
			
			
			char[] sChar = s.toCharArray();
			char[] tChar = t.toCharArray();
			
			int len = tChar.length;
			for(int i = 0 ; i < s.length() - t.length() + 1; i++ ) {
				
				int cLen = 0;
				for(int j = 0 ; j < t.length() ; j++ ) {
					if ( sChar[i+j] != tChar[j]) {
						cLen++;
					}
					
				}
				
				if ( cLen < len ) {
					len = cLen;
				}
			}
			
			System.out.println(len);
		
		}
	} try(Scanner sc = new Scanner(System.in)) {
			
			String s = sc.next();
			String t = sc.next();
			
			
			char[] sChar = s.toCharArray();
			char[] tChar = t.toCharArray();
			
			int len = tChar.length;
			for(int i = 0 ; i < s.length() - t.length() + 1; i++ ) {
				
				int cLen = 0;
				for(int j = 0 ; j < t.length() ; j++ ) {
					if ( sChar[i+j] != tChar[j]) {
						cLen++;
					}
					
				}
				
				if ( cLen < len ) {
					len = cLen;
				}
			}
			
			System.out.println(len);
		
		} {
			
			String s = sc.next();
			String t = sc.next();
			
			
			char[] sChar = s.toCharArray();
			char[] tChar = t.toCharArray();
			
			int len = tChar.length;
			for(int i = 0 ; i < s.length() - t.length() + 1; i++ ) {
				
				int cLen = 0;
				for(int j = 0 ; j < t.length() ; j++ ) {
					if ( sChar[i+j] != tChar[j]) {
						cLen++;
					}
					
				}
				
				if ( cLen < len ) {
					len = cLen;
				}
			}
			
			System.out.println(len);
		
		} Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc char[] sChar = s.toCharArray(); sChar s.toCharArray() s.toCharArray s char[] tChar = t.toCharArray(); tChar t.toCharArray() t.toCharArray t int len = tChar.length; len tChar.length tChar tChar.length for(int i = 0 ; i < s.length() - t.length() + 1; i++ ) {
				
				int cLen = 0;
				for(int j = 0 ; j < t.length() ; j++ ) {
					if ( sChar[i+j] != tChar[j]) {
						cLen++;
					}
					
				}
				
				if ( cLen < len ) {
					len = cLen;
				}
			} 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 {
				
				int cLen = 0;
				for(int j = 0 ; j < t.length() ; j++ ) {
					if ( sChar[i+j] != tChar[j]) {
						cLen++;
					}
					
				}
				
				if ( cLen < len ) {
					len = cLen;
				}
			} {
				
				int cLen = 0;
				for(int j = 0 ; j < t.length() ; j++ ) {
					if ( sChar[i+j] != tChar[j]) {
						cLen++;
					}
					
				}
				
				if ( cLen < len ) {
					len = cLen;
				}
			} int cLen = 0; cLen 0 for(int j = 0 ; j < t.length() ; j++ ) {
					if ( sChar[i+j] != tChar[j]) {
						cLen++;
					}
					
				} int j = 0 ; int j = 0 ; j 0 j < t.length() j t.length() t.length t j++ j++ j {
					if ( sChar[i+j] != tChar[j]) {
						cLen++;
					}
					
				} {
					if ( sChar[i+j] != tChar[j]) {
						cLen++;
					}
					
				} if ( sChar[i+j] != tChar[j]) {
						cLen++;
					} sChar[i+j] != tChar[j] sChar[i+j] sChar i+j i j tChar[j] tChar j {
						cLen++;
					} cLen++ cLen if ( cLen < len ) {
					len = cLen;
				} cLen < len cLen len {
					len = cLen;
				} len = cLen len cLen System.out.println(len) System.out.println System.out System System.out len String[] args args public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {
			
			String s = sc.next();
			String t = sc.next();
			
			
			char[] sChar = s.toCharArray();
			char[] tChar = t.toCharArray();
			
			int len = tChar.length;
			for(int i = 0 ; i < s.length() - t.length() + 1; i++ ) {
				
				int cLen = 0;
				for(int j = 0 ; j < t.length() ; j++ ) {
					if ( sChar[i+j] != tChar[j]) {
						cLen++;
					}
					
				}
				
				if ( cLen < len ) {
					len = cLen;
				}
			}
			
			System.out.println(len);
		
		}
	}

} public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {
			
			String s = sc.next();
			String t = sc.next();
			
			
			char[] sChar = s.toCharArray();
			char[] tChar = t.toCharArray();
			
			int len = tChar.length;
			for(int i = 0 ; i < s.length() - t.length() + 1; i++ ) {
				
				int cLen = 0;
				for(int j = 0 ; j < t.length() ; j++ ) {
					if ( sChar[i+j] != tChar[j]) {
						cLen++;
					}
					
				}
				
				if ( cLen < len ) {
					len = cLen;
				}
			}
			
			System.out.println(len);
		
		}
	}

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {
			
			String s = sc.next();
			String t = sc.next();
			
			
			char[] sChar = s.toCharArray();
			char[] tChar = t.toCharArray();
			
			int len = tChar.length;
			for(int i = 0 ; i < s.length() - t.length() + 1; i++ ) {
				
				int cLen = 0;
				for(int j = 0 ; j < t.length() ; j++ ) {
					if ( sChar[i+j] != tChar[j]) {
						cLen++;
					}
					
				}
				
				if ( cLen < len ) {
					len = cLen;
				}
			}
			
			System.out.println(len);
		
		}
	}

}