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