import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();
		
		int out = Integer.MAX_VALUE;
		
		for(int i = 0; i<s.length() - t.length()+1; i++) {
			int diff = 0;
			for(int j = 0; j<t.length(); j++) {
				if(s.charAt(j+i) != t.charAt(j)) diff++;
			}
			out = Math.min(out,  diff);
		}
		System.out.println(out);
		
	}
} 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.next();
		String t = sc.next();
		
		int out = Integer.MAX_VALUE;
		
		for(int i = 0; i<s.length() - t.length()+1; i++) {
			int diff = 0;
			for(int j = 0; j<t.length(); j++) {
				if(s.charAt(j+i) != t.charAt(j)) diff++;
			}
			out = Math.min(out,  diff);
		}
		System.out.println(out);
		
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();
		
		int out = Integer.MAX_VALUE;
		
		for(int i = 0; i<s.length() - t.length()+1; i++) {
			int diff = 0;
			for(int j = 0; j<t.length(); j++) {
				if(s.charAt(j+i) != t.charAt(j)) diff++;
			}
			out = Math.min(out,  diff);
		}
		System.out.println(out);
		
	} main {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();
		
		int out = Integer.MAX_VALUE;
		
		for(int i = 0; i<s.length() - t.length()+1; i++) {
			int diff = 0;
			for(int j = 0; j<t.length(); j++) {
				if(s.charAt(j+i) != t.charAt(j)) diff++;
			}
			out = Math.min(out,  diff);
		}
		System.out.println(out);
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc int out = Integer.MAX_VALUE; out Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i = 0; i<s.length() - t.length()+1; i++) {
			int diff = 0;
			for(int j = 0; j<t.length(); j++) {
				if(s.charAt(j+i) != t.charAt(j)) diff++;
			}
			out = Math.min(out,  diff);
		} 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 diff = 0;
			for(int j = 0; j<t.length(); j++) {
				if(s.charAt(j+i) != t.charAt(j)) diff++;
			}
			out = Math.min(out,  diff);
		} {
			int diff = 0;
			for(int j = 0; j<t.length(); j++) {
				if(s.charAt(j+i) != t.charAt(j)) diff++;
			}
			out = Math.min(out,  diff);
		} int diff = 0; diff 0 for(int j = 0; j<t.length(); j++) {
				if(s.charAt(j+i) != t.charAt(j)) diff++;
			} int j = 0; int j = 0; j 0 j<t.length() j t.length() t.length t j++ j++ j {
				if(s.charAt(j+i) != t.charAt(j)) diff++;
			} {
				if(s.charAt(j+i) != t.charAt(j)) diff++;
			} if(s.charAt(j+i) != t.charAt(j)) diff++; s.charAt(j+i) != t.charAt(j) s.charAt(j+i) s.charAt s j+i j i t.charAt(j) t.charAt t j diff++ diff out = Math.min(out,  diff) out Math.min(out,  diff) Math.min Math out diff System.out.println(out) System.out.println System.out System System.out out String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();
		
		int out = Integer.MAX_VALUE;
		
		for(int i = 0; i<s.length() - t.length()+1; i++) {
			int diff = 0;
			for(int j = 0; j<t.length(); j++) {
				if(s.charAt(j+i) != t.charAt(j)) diff++;
			}
			out = Math.min(out,  diff);
		}
		System.out.println(out);
		
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();
		
		int out = Integer.MAX_VALUE;
		
		for(int i = 0; i<s.length() - t.length()+1; i++) {
			int diff = 0;
			for(int j = 0; j<t.length(); j++) {
				if(s.charAt(j+i) != t.charAt(j)) diff++;
			}
			out = Math.min(out,  diff);
		}
		System.out.println(out);
		
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();
		
		int out = Integer.MAX_VALUE;
		
		for(int i = 0; i<s.length() - t.length()+1; i++) {
			int diff = 0;
			for(int j = 0; j<t.length(); j++) {
				if(s.charAt(j+i) != t.charAt(j)) diff++;
			}
			out = Math.min(out,  diff);
		}
		System.out.println(out);
		
	}
}
