import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		int count = 0;
		int countDummy = 0;
		for(int i = 0; i<s.length()-t.length()+1; i++) {
				String sDummy = s.substring(i, i+t.length());
				for(int j=0; j<t.length(); j++) {
					if(sDummy.charAt(j)==t.charAt(j)) {
						countDummy++;
					}
		}
				if(countDummy > count) {
					count = countDummy;
				}
				countDummy = 0;
			
			
		}

		
		System.out.println(t.length()-count);
		}

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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		int count = 0;
		int countDummy = 0;
		for(int i = 0; i<s.length()-t.length()+1; i++) {
				String sDummy = s.substring(i, i+t.length());
				for(int j=0; j<t.length(); j++) {
					if(sDummy.charAt(j)==t.charAt(j)) {
						countDummy++;
					}
		}
				if(countDummy > count) {
					count = countDummy;
				}
				countDummy = 0;
			
			
		}

		
		System.out.println(t.length()-count);
		}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		int count = 0;
		int countDummy = 0;
		for(int i = 0; i<s.length()-t.length()+1; i++) {
				String sDummy = s.substring(i, i+t.length());
				for(int j=0; j<t.length(); j++) {
					if(sDummy.charAt(j)==t.charAt(j)) {
						countDummy++;
					}
		}
				if(countDummy > count) {
					count = countDummy;
				}
				countDummy = 0;
			
			
		}

		
		System.out.println(t.length()-count);
		} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		int count = 0;
		int countDummy = 0;
		for(int i = 0; i<s.length()-t.length()+1; i++) {
				String sDummy = s.substring(i, i+t.length());
				for(int j=0; j<t.length(); j++) {
					if(sDummy.charAt(j)==t.charAt(j)) {
						countDummy++;
					}
		}
				if(countDummy > count) {
					count = countDummy;
				}
				countDummy = 0;
			
			
		}

		
		System.out.println(t.length()-count);
		} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String t = sc.nextLine(); t sc.nextLine() sc.nextLine sc int count = 0; count 0 int countDummy = 0; countDummy 0 for(int i = 0; i<s.length()-t.length()+1; i++) {
				String sDummy = s.substring(i, i+t.length());
				for(int j=0; j<t.length(); j++) {
					if(sDummy.charAt(j)==t.charAt(j)) {
						countDummy++;
					}
		}
				if(countDummy > count) {
					count = countDummy;
				}
				countDummy = 0;
			
			
		} 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 sDummy = s.substring(i, i+t.length());
				for(int j=0; j<t.length(); j++) {
					if(sDummy.charAt(j)==t.charAt(j)) {
						countDummy++;
					}
		}
				if(countDummy > count) {
					count = countDummy;
				}
				countDummy = 0;
			
			
		} {
				String sDummy = s.substring(i, i+t.length());
				for(int j=0; j<t.length(); j++) {
					if(sDummy.charAt(j)==t.charAt(j)) {
						countDummy++;
					}
		}
				if(countDummy > count) {
					count = countDummy;
				}
				countDummy = 0;
			
			
		} String sDummy = s.substring(i, i+t.length()); sDummy s.substring(i, i+t.length()) s.substring s i i+t.length() i t.length() t.length t for(int j=0; j<t.length(); j++) {
					if(sDummy.charAt(j)==t.charAt(j)) {
						countDummy++;
					}
		} int j=0; int j=0; j 0 j<t.length() j t.length() t.length t j++ j++ j {
					if(sDummy.charAt(j)==t.charAt(j)) {
						countDummy++;
					}
		} {
					if(sDummy.charAt(j)==t.charAt(j)) {
						countDummy++;
					}
		} if(sDummy.charAt(j)==t.charAt(j)) {
						countDummy++;
					} sDummy.charAt(j)==t.charAt(j) sDummy.charAt(j) sDummy.charAt sDummy j t.charAt(j) t.charAt t j {
						countDummy++;
					} countDummy++ countDummy if(countDummy > count) {
					count = countDummy;
				} countDummy > count countDummy count {
					count = countDummy;
				} count = countDummy count countDummy countDummy = 0 countDummy 0 System.out.println(t.length()-count) System.out.println System.out System System.out t.length()-count t.length() t.length t count String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		int count = 0;
		int countDummy = 0;
		for(int i = 0; i<s.length()-t.length()+1; i++) {
				String sDummy = s.substring(i, i+t.length());
				for(int j=0; j<t.length(); j++) {
					if(sDummy.charAt(j)==t.charAt(j)) {
						countDummy++;
					}
		}
				if(countDummy > count) {
					count = countDummy;
				}
				countDummy = 0;
			
			
		}

		
		System.out.println(t.length()-count);
		}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		int count = 0;
		int countDummy = 0;
		for(int i = 0; i<s.length()-t.length()+1; i++) {
				String sDummy = s.substring(i, i+t.length());
				for(int j=0; j<t.length(); j++) {
					if(sDummy.charAt(j)==t.charAt(j)) {
						countDummy++;
					}
		}
				if(countDummy > count) {
					count = countDummy;
				}
				countDummy = 0;
			
			
		}

		
		System.out.println(t.length()-count);
		}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		int count = 0;
		int countDummy = 0;
		for(int i = 0; i<s.length()-t.length()+1; i++) {
				String sDummy = s.substring(i, i+t.length());
				for(int j=0; j<t.length(); j++) {
					if(sDummy.charAt(j)==t.charAt(j)) {
						countDummy++;
					}
		}
				if(countDummy > count) {
					count = countDummy;
				}
				countDummy = 0;
			
			
		}

		
		System.out.println(t.length()-count);
		}

}