import 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 counter = 0;
		for(int i = 0;i < (S.length() - T.length() + 1);i++){
			int count2 = 0;
			for(int j = 0;j < T.length();j++){
				if(S.charAt(i + j) == T.charAt(j)){
					count2++;
				}
			}
			counter = Math.max(counter,count2);
		}
		System.out.println(T.length() - counter);
	}
} import java.util.*; util.* java public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int counter = 0;
		for(int i = 0;i < (S.length() - T.length() + 1);i++){
			int count2 = 0;
			for(int j = 0;j < T.length();j++){
				if(S.charAt(i + j) == T.charAt(j)){
					count2++;
				}
			}
			counter = Math.max(counter,count2);
		}
		System.out.println(T.length() - counter);
	}
} Main public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int counter = 0;
		for(int i = 0;i < (S.length() - T.length() + 1);i++){
			int count2 = 0;
			for(int j = 0;j < T.length();j++){
				if(S.charAt(i + j) == T.charAt(j)){
					count2++;
				}
			}
			counter = Math.max(counter,count2);
		}
		System.out.println(T.length() - counter);
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int counter = 0;
		for(int i = 0;i < (S.length() - T.length() + 1);i++){
			int count2 = 0;
			for(int j = 0;j < T.length();j++){
				if(S.charAt(i + j) == T.charAt(j)){
					count2++;
				}
			}
			counter = Math.max(counter,count2);
		}
		System.out.println(T.length() - counter);
	} 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 counter = 0; counter 0 for(int i = 0;i < (S.length() - T.length() + 1);i++){
			int count2 = 0;
			for(int j = 0;j < T.length();j++){
				if(S.charAt(i + j) == T.charAt(j)){
					count2++;
				}
			}
			counter = Math.max(counter,count2);
		} 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 count2 = 0;
			for(int j = 0;j < T.length();j++){
				if(S.charAt(i + j) == T.charAt(j)){
					count2++;
				}
			}
			counter = Math.max(counter,count2);
		} {
			int count2 = 0;
			for(int j = 0;j < T.length();j++){
				if(S.charAt(i + j) == T.charAt(j)){
					count2++;
				}
			}
			counter = Math.max(counter,count2);
		} int count2 = 0; count2 0 for(int j = 0;j < T.length();j++){
				if(S.charAt(i + j) == T.charAt(j)){
					count2++;
				}
			} int j = 0; int j = 0; j 0 j < T.length() j T.length() T.length T j++ j++ j {
				if(S.charAt(i + j) == T.charAt(j)){
					count2++;
				}
			} {
				if(S.charAt(i + j) == T.charAt(j)){
					count2++;
				}
			} if(S.charAt(i + j) == T.charAt(j)){
					count2++;
				} S.charAt(i + j) == T.charAt(j) S.charAt(i + j) S.charAt S i + j i j T.charAt(j) T.charAt T j {
					count2++;
				} count2++ count2 counter = Math.max(counter,count2) counter Math.max(counter,count2) Math.max Math counter count2 System.out.println(T.length() - counter) System.out.println System.out System System.out T.length() - counter T.length() T.length T counter 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 counter = 0;
		for(int i = 0;i < (S.length() - T.length() + 1);i++){
			int count2 = 0;
			for(int j = 0;j < T.length();j++){
				if(S.charAt(i + j) == T.charAt(j)){
					count2++;
				}
			}
			counter = Math.max(counter,count2);
		}
		System.out.println(T.length() - counter);
	}
} public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int counter = 0;
		for(int i = 0;i < (S.length() - T.length() + 1);i++){
			int count2 = 0;
			for(int j = 0;j < T.length();j++){
				if(S.charAt(i + j) == T.charAt(j)){
					count2++;
				}
			}
			counter = Math.max(counter,count2);
		}
		System.out.println(T.length() - counter);
	}
} Main
import 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 counter = 0;
		for(int i = 0;i < (S.length() - T.length() + 1);i++){
			int count2 = 0;
			for(int j = 0;j < T.length();j++){
				if(S.charAt(i + j) == T.charAt(j)){
					count2++;
				}
			}
			counter = Math.max(counter,count2);
		}
		System.out.println(T.length() - counter);
	}
}