import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		String t = sc.next();
		
		// 計算
		int result = 100000;
		for(int i = 0; i < s.length()-t.length()+1; i++){
		    int tmp = 0;
		    for(int j = 0; j < t.length(); j++){
		        if(s.charAt(i+j) != t.charAt(j)) tmp++;
		    }
		    result = min(result, tmp);
		}
		
		
		// 出力
		System.out.println(result);
	}
	
	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
} import java.util.*; util.* java import java.io.*; io.* java import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		String t = sc.next();
		
		// 計算
		int result = 100000;
		for(int i = 0; i < s.length()-t.length()+1; i++){
		    int tmp = 0;
		    for(int j = 0; j < t.length(); j++){
		        if(s.charAt(i+j) != t.charAt(j)) tmp++;
		    }
		    result = min(result, tmp);
		}
		
		
		// 出力
		System.out.println(result);
	}
	
	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
} Main public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		String t = sc.next();
		
		// 計算
		int result = 100000;
		for(int i = 0; i < s.length()-t.length()+1; i++){
		    int tmp = 0;
		    for(int j = 0; j < t.length(); j++){
		        if(s.charAt(i+j) != t.charAt(j)) tmp++;
		    }
		    result = min(result, tmp);
		}
		
		
		// 出力
		System.out.println(result);
	} main {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		String t = sc.next();
		
		// 計算
		int result = 100000;
		for(int i = 0; i < s.length()-t.length()+1; i++){
		    int tmp = 0;
		    for(int j = 0; j < t.length(); j++){
		        if(s.charAt(i+j) != t.charAt(j)) tmp++;
		    }
		    result = min(result, tmp);
		}
		
		
		// 出力
		System.out.println(result);
	} 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 result = 100000; result 100000 for(int i = 0; i < s.length()-t.length()+1; i++){
		    int tmp = 0;
		    for(int j = 0; j < t.length(); j++){
		        if(s.charAt(i+j) != t.charAt(j)) tmp++;
		    }
		    result = min(result, tmp);
		} 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 tmp = 0;
		    for(int j = 0; j < t.length(); j++){
		        if(s.charAt(i+j) != t.charAt(j)) tmp++;
		    }
		    result = min(result, tmp);
		} {
		    int tmp = 0;
		    for(int j = 0; j < t.length(); j++){
		        if(s.charAt(i+j) != t.charAt(j)) tmp++;
		    }
		    result = min(result, tmp);
		} int tmp = 0; tmp 0 for(int j = 0; j < t.length(); j++){
		        if(s.charAt(i+j) != t.charAt(j)) tmp++;
		    } 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)) tmp++;
		    } {
		        if(s.charAt(i+j) != t.charAt(j)) tmp++;
		    } if(s.charAt(i+j) != t.charAt(j)) tmp++; 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 tmp++ tmp result = min(result, tmp) result min(result, tmp) min result tmp System.out.println(result) System.out.println System.out System System.out result String[] args args public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	} Scanner private BufferedReader br; br private StringTokenizer tok; tok public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));} Scanner { br = new BufferedReader(new InputStreamReader(is));} br = new BufferedReader(new InputStreamReader(is)) br new BufferedReader(new InputStreamReader(is)) InputStream is is private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());} getLine { while(!hasNext()) tok = new StringTokenizer(br.readLine());} while(!hasNext()) tok = new StringTokenizer(br.readLine()); !hasNext() hasNext() hasNext tok = new StringTokenizer(br.readLine()) tok new StringTokenizer(br.readLine()) private boolean hasNext() { return tok != null && tok.hasMoreTokens();} hasNext { return tok != null && tok.hasMoreTokens();} return tok != null && tok.hasMoreTokens(); tok != null && tok.hasMoreTokens() tok != null tok null tok.hasMoreTokens() tok.hasMoreTokens tok public String next() throws IOException { getLine(); return tok.nextToken();} next { getLine(); return tok.nextToken();} getLine() getLine return tok.nextToken(); tok.nextToken() tok.nextToken tok public int nextInt() throws IOException { return Integer.parseInt(next());} nextInt { return Integer.parseInt(next());} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public long nextLong() throws IOException { return Long.parseLong(next());} nextLong { return Long.parseLong(next());} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public double nextDouble() throws IOException { return Double.parseDouble(next());} nextDouble { return Double.parseDouble(next());} return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		String t = sc.next();
		
		// 計算
		int result = 100000;
		for(int i = 0; i < s.length()-t.length()+1; i++){
		    int tmp = 0;
		    for(int j = 0; j < t.length(); j++){
		        if(s.charAt(i+j) != t.charAt(j)) tmp++;
		    }
		    result = min(result, tmp);
		}
		
		
		// 出力
		System.out.println(result);
	}
	
	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
} public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		String t = sc.next();
		
		// 計算
		int result = 100000;
		for(int i = 0; i < s.length()-t.length()+1; i++){
		    int tmp = 0;
		    for(int j = 0; j < t.length(); j++){
		        if(s.charAt(i+j) != t.charAt(j)) tmp++;
		    }
		    result = min(result, tmp);
		}
		
		
		// 出力
		System.out.println(result);
	}
	
	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
} Main
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		String t = sc.next();
		
		// 計算
		int result = 100000;
		for(int i = 0; i < s.length()-t.length()+1; i++){
		    int tmp = 0;
		    for(int j = 0; j < t.length(); j++){
		        if(s.charAt(i+j) != t.charAt(j)) tmp++;
		    }
		    result = min(result, tmp);
		}
		
		
		// 出力
		System.out.println(result);
	}
	
	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
}
