import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		String s = bf.readLine().trim();
 		String t = bf.readLine().trim();
 		int min = Integer.MAX_VALUE;
 		for(int j = 0;j<=s.length()-t.length();j++){
 			int count = 0;
 			for(int k = 0;k<t.length();k++){
 				if (t.charAt(k) != s.charAt(j+k))
 					count++;
 			}
 			min = Math.min(count,  min);
 		}
 		
 		
 		out.println(min);
	 		
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	

 import java.util.*; util.* java import java.io.*; io.* java public class Main {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		String s = bf.readLine().trim();
 		String t = bf.readLine().trim();
 		int min = Integer.MAX_VALUE;
 		for(int j = 0;j<=s.length()-t.length();j++){
 			int count = 0;
 			for(int k = 0;k<t.length();k++){
 				if (t.charAt(k) != s.charAt(j+k))
 					count++;
 			}
 			min = Math.min(count,  min);
 		}
 		
 		
 		out.println(min);
	 		
 		out.close();
 		
 		
 		
 	}
} Main public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		String s = bf.readLine().trim();
 		String t = bf.readLine().trim();
 		int min = Integer.MAX_VALUE;
 		for(int j = 0;j<=s.length()-t.length();j++){
 			int count = 0;
 			for(int k = 0;k<t.length();k++){
 				if (t.charAt(k) != s.charAt(j+k))
 					count++;
 			}
 			min = Math.min(count,  min);
 		}
 		
 		
 		out.println(min);
	 		
 		out.close();
 		
 		
 		
 	} main {
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		String s = bf.readLine().trim();
 		String t = bf.readLine().trim();
 		int min = Integer.MAX_VALUE;
 		for(int j = 0;j<=s.length()-t.length();j++){
 			int count = 0;
 			for(int k = 0;k<t.length();k++){
 				if (t.charAt(k) != s.charAt(j+k))
 					count++;
 			}
 			min = Math.min(count,  min);
 		}
 		
 		
 		out.println(min);
	 		
 		out.close();
 		
 		
 		
 	} int num = 998244353; num 998244353 BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); bf new BufferedReader(new InputStreamReader(System.in)) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) String s = bf.readLine().trim(); s bf.readLine().trim() bf.readLine().trim bf.readLine() bf.readLine bf String t = bf.readLine().trim(); t bf.readLine().trim() bf.readLine().trim bf.readLine() bf.readLine bf int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int j = 0;j<=s.length()-t.length();j++){
 			int count = 0;
 			for(int k = 0;k<t.length();k++){
 				if (t.charAt(k) != s.charAt(j+k))
 					count++;
 			}
 			min = Math.min(count,  min);
 		} int j = 0; int j = 0; j 0 j<=s.length()-t.length() j s.length()-t.length() s.length() s.length s t.length() t.length t j++ j++ j {
 			int count = 0;
 			for(int k = 0;k<t.length();k++){
 				if (t.charAt(k) != s.charAt(j+k))
 					count++;
 			}
 			min = Math.min(count,  min);
 		} {
 			int count = 0;
 			for(int k = 0;k<t.length();k++){
 				if (t.charAt(k) != s.charAt(j+k))
 					count++;
 			}
 			min = Math.min(count,  min);
 		} int count = 0; count 0 for(int k = 0;k<t.length();k++){
 				if (t.charAt(k) != s.charAt(j+k))
 					count++;
 			} int k = 0; int k = 0; k 0 k<t.length() k t.length() t.length t k++ k++ k {
 				if (t.charAt(k) != s.charAt(j+k))
 					count++;
 			} {
 				if (t.charAt(k) != s.charAt(j+k))
 					count++;
 			} if (t.charAt(k) != s.charAt(j+k))
 					count++; t.charAt(k) != s.charAt(j+k) t.charAt(k) t.charAt t k s.charAt(j+k) s.charAt s j+k j k count++ count min = Math.min(count,  min) min Math.min(count,  min) Math.min Math count min out.println(min) out.println out min out.close() out.close out String[] args args public class Main {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		String s = bf.readLine().trim();
 		String t = bf.readLine().trim();
 		int min = Integer.MAX_VALUE;
 		for(int j = 0;j<=s.length()-t.length();j++){
 			int count = 0;
 			for(int k = 0;k<t.length();k++){
 				if (t.charAt(k) != s.charAt(j+k))
 					count++;
 			}
 			min = Math.min(count,  min);
 		}
 		
 		
 		out.println(min);
	 		
 		out.close();
 		
 		
 		
 	}
} public class Main {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		String s = bf.readLine().trim();
 		String t = bf.readLine().trim();
 		int min = Integer.MAX_VALUE;
 		for(int j = 0;j<=s.length()-t.length();j++){
 			int count = 0;
 			for(int k = 0;k<t.length();k++){
 				if (t.charAt(k) != s.charAt(j+k))
 					count++;
 			}
 			min = Math.min(count,  min);
 		}
 		
 		
 		out.println(min);
	 		
 		out.close();
 		
 		
 		
 	}
} Main
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		String s = bf.readLine().trim();
 		String t = bf.readLine().trim();
 		int min = Integer.MAX_VALUE;
 		for(int j = 0;j<=s.length()-t.length();j++){
 			int count = 0;
 			for(int k = 0;k<t.length();k++){
 				if (t.charAt(k) != s.charAt(j+k))
 					count++;
 			}
 			min = Math.min(count,  min);
 		}
 		
 		
 		out.println(min);
	 		
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	


