import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		String s1=scn.next();
		String s2=scn.next();
		int max=0;
		for(int i=0;i<=s1.length()-s2.length();i++){
			int scnt=0;
			for(int j=0;j<s2.length();j++){
				if(s1.charAt(i+j)==s2.charAt(j)){
					scnt++;
				}
			}
			max=Math.max(max, scnt);
		}
		System.out.println(s2.length()-max);
	   

	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		String s1=scn.next();
		String s2=scn.next();
		int max=0;
		for(int i=0;i<=s1.length()-s2.length();i++){
			int scnt=0;
			for(int j=0;j<s2.length();j++){
				if(s1.charAt(i+j)==s2.charAt(j)){
					scnt++;
				}
			}
			max=Math.max(max, scnt);
		}
		System.out.println(s2.length()-max);
	   

	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		String s1=scn.next();
		String s2=scn.next();
		int max=0;
		for(int i=0;i<=s1.length()-s2.length();i++){
			int scnt=0;
			for(int j=0;j<s2.length();j++){
				if(s1.charAt(i+j)==s2.charAt(j)){
					scnt++;
				}
			}
			max=Math.max(max, scnt);
		}
		System.out.println(s2.length()-max);
	   

	} main {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		String s1=scn.next();
		String s2=scn.next();
		int max=0;
		for(int i=0;i<=s1.length()-s2.length();i++){
			int scnt=0;
			for(int j=0;j<s2.length();j++){
				if(s1.charAt(i+j)==s2.charAt(j)){
					scnt++;
				}
			}
			max=Math.max(max, scnt);
		}
		System.out.println(s2.length()-max);
	   

	} Scanner scn=new Scanner(System.in); scn new Scanner(System.in) String s1=scn.next(); s1 scn.next() scn.next scn String s2=scn.next(); s2 scn.next() scn.next scn int max=0; max 0 for(int i=0;i<=s1.length()-s2.length();i++){
			int scnt=0;
			for(int j=0;j<s2.length();j++){
				if(s1.charAt(i+j)==s2.charAt(j)){
					scnt++;
				}
			}
			max=Math.max(max, scnt);
		} int i=0; int i=0; i 0 i<=s1.length()-s2.length() i s1.length()-s2.length() s1.length() s1.length s1 s2.length() s2.length s2 i++ i++ i {
			int scnt=0;
			for(int j=0;j<s2.length();j++){
				if(s1.charAt(i+j)==s2.charAt(j)){
					scnt++;
				}
			}
			max=Math.max(max, scnt);
		} {
			int scnt=0;
			for(int j=0;j<s2.length();j++){
				if(s1.charAt(i+j)==s2.charAt(j)){
					scnt++;
				}
			}
			max=Math.max(max, scnt);
		} int scnt=0; scnt 0 for(int j=0;j<s2.length();j++){
				if(s1.charAt(i+j)==s2.charAt(j)){
					scnt++;
				}
			} int j=0; int j=0; j 0 j<s2.length() j s2.length() s2.length s2 j++ j++ j {
				if(s1.charAt(i+j)==s2.charAt(j)){
					scnt++;
				}
			} {
				if(s1.charAt(i+j)==s2.charAt(j)){
					scnt++;
				}
			} if(s1.charAt(i+j)==s2.charAt(j)){
					scnt++;
				} s1.charAt(i+j)==s2.charAt(j) s1.charAt(i+j) s1.charAt s1 i+j i j s2.charAt(j) s2.charAt s2 j {
					scnt++;
				} scnt++ scnt max=Math.max(max, scnt) max Math.max(max, scnt) Math.max Math max scnt System.out.println(s2.length()-max) System.out.println System.out System System.out s2.length()-max s2.length() s2.length s2 max String[] args args public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		String s1=scn.next();
		String s2=scn.next();
		int max=0;
		for(int i=0;i<=s1.length()-s2.length();i++){
			int scnt=0;
			for(int j=0;j<s2.length();j++){
				if(s1.charAt(i+j)==s2.charAt(j)){
					scnt++;
				}
			}
			max=Math.max(max, scnt);
		}
		System.out.println(s2.length()-max);
	   

	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		String s1=scn.next();
		String s2=scn.next();
		int max=0;
		for(int i=0;i<=s1.length()-s2.length();i++){
			int scnt=0;
			for(int j=0;j<s2.length();j++){
				if(s1.charAt(i+j)==s2.charAt(j)){
					scnt++;
				}
			}
			max=Math.max(max, scnt);
		}
		System.out.println(s2.length()-max);
	   

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		String s1=scn.next();
		String s2=scn.next();
		int max=0;
		for(int i=0;i<=s1.length()-s2.length();i++){
			int scnt=0;
			for(int j=0;j<s2.length();j++){
				if(s1.charAt(i+j)==s2.charAt(j)){
					scnt++;
				}
			}
			max=Math.max(max, scnt);
		}
		System.out.println(s2.length()-max);
	   

	}

}