import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		
		Scanner in = new java.util.Scanner(System.in);
		char[] S = in.next().toCharArray();
		char[] T = in.next().toCharArray();
		int min = T.length;
		int diff;
		for(int i=0; i<=S.length-T.length; i++) {
			diff = 0;
			for(int j=0; j<T.length; j++) {
				if(S[i+j] != T[j]) {
					diff++;
				}
			}
			if(min > diff) {
				min = diff;
			}
		}
		
		System.out.println(min);
		
		
		in.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		
		Scanner in = new java.util.Scanner(System.in);
		char[] S = in.next().toCharArray();
		char[] T = in.next().toCharArray();
		int min = T.length;
		int diff;
		for(int i=0; i<=S.length-T.length; i++) {
			diff = 0;
			for(int j=0; j<T.length; j++) {
				if(S[i+j] != T[j]) {
					diff++;
				}
			}
			if(min > diff) {
				min = diff;
			}
		}
		
		System.out.println(min);
		
		
		in.close();
	}
} Main public static void main(String[] args){
		
		Scanner in = new java.util.Scanner(System.in);
		char[] S = in.next().toCharArray();
		char[] T = in.next().toCharArray();
		int min = T.length;
		int diff;
		for(int i=0; i<=S.length-T.length; i++) {
			diff = 0;
			for(int j=0; j<T.length; j++) {
				if(S[i+j] != T[j]) {
					diff++;
				}
			}
			if(min > diff) {
				min = diff;
			}
		}
		
		System.out.println(min);
		
		
		in.close();
	} main {
		
		Scanner in = new java.util.Scanner(System.in);
		char[] S = in.next().toCharArray();
		char[] T = in.next().toCharArray();
		int min = T.length;
		int diff;
		for(int i=0; i<=S.length-T.length; i++) {
			diff = 0;
			for(int j=0; j<T.length; j++) {
				if(S[i+j] != T[j]) {
					diff++;
				}
			}
			if(min > diff) {
				min = diff;
			}
		}
		
		System.out.println(min);
		
		
		in.close();
	} Scanner in = new java.util.Scanner(System.in); in new java.util.Scanner(System.in) char[] S = in.next().toCharArray(); S in.next().toCharArray() in.next().toCharArray in.next() in.next in char[] T = in.next().toCharArray(); T in.next().toCharArray() in.next().toCharArray in.next() in.next in int min = T.length; min T.length T T.length int diff; diff for(int i=0; i<=S.length-T.length; i++) {
			diff = 0;
			for(int j=0; j<T.length; j++) {
				if(S[i+j] != T[j]) {
					diff++;
				}
			}
			if(min > diff) {
				min = diff;
			}
		} int i=0; int i=0; i 0 i<=S.length-T.length i S.length-T.length S.length S S.length T.length T T.length i++ i++ i {
			diff = 0;
			for(int j=0; j<T.length; j++) {
				if(S[i+j] != T[j]) {
					diff++;
				}
			}
			if(min > diff) {
				min = diff;
			}
		} {
			diff = 0;
			for(int j=0; j<T.length; j++) {
				if(S[i+j] != T[j]) {
					diff++;
				}
			}
			if(min > diff) {
				min = diff;
			}
		} diff = 0 diff 0 for(int j=0; j<T.length; j++) {
				if(S[i+j] != T[j]) {
					diff++;
				}
			} int j=0; int j=0; j 0 j<T.length j T.length T T.length j++ j++ j {
				if(S[i+j] != T[j]) {
					diff++;
				}
			} {
				if(S[i+j] != T[j]) {
					diff++;
				}
			} if(S[i+j] != T[j]) {
					diff++;
				} S[i+j] != T[j] S[i+j] S i+j i j T[j] T j {
					diff++;
				} diff++ diff if(min > diff) {
				min = diff;
			} min > diff min diff {
				min = diff;
			} min = diff min diff System.out.println(min) System.out.println System.out System System.out min in.close() in.close in String[] args args public class Main {
	public static void main(String[] args){
		
		Scanner in = new java.util.Scanner(System.in);
		char[] S = in.next().toCharArray();
		char[] T = in.next().toCharArray();
		int min = T.length;
		int diff;
		for(int i=0; i<=S.length-T.length; i++) {
			diff = 0;
			for(int j=0; j<T.length; j++) {
				if(S[i+j] != T[j]) {
					diff++;
				}
			}
			if(min > diff) {
				min = diff;
			}
		}
		
		System.out.println(min);
		
		
		in.close();
	}
} public class Main {
	public static void main(String[] args){
		
		Scanner in = new java.util.Scanner(System.in);
		char[] S = in.next().toCharArray();
		char[] T = in.next().toCharArray();
		int min = T.length;
		int diff;
		for(int i=0; i<=S.length-T.length; i++) {
			diff = 0;
			for(int j=0; j<T.length; j++) {
				if(S[i+j] != T[j]) {
					diff++;
				}
			}
			if(min > diff) {
				min = diff;
			}
		}
		
		System.out.println(min);
		
		
		in.close();
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		
		Scanner in = new java.util.Scanner(System.in);
		char[] S = in.next().toCharArray();
		char[] T = in.next().toCharArray();
		int min = T.length;
		int diff;
		for(int i=0; i<=S.length-T.length; i++) {
			diff = 0;
			for(int j=0; j<T.length; j++) {
				if(S[i+j] != T[j]) {
					diff++;
				}
			}
			if(min > diff) {
				min = diff;
			}
		}
		
		System.out.println(min);
		
		
		in.close();
	}
}
