import java.util.*;
import java.io.*;
import java.math.BigInteger;
 
public class Main {
	public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	String S = s.next();
	String T = s.next();
	
	int max = T.length();
	for(int i = 0; i <= S.length()-T.length(); i++){
		int count = T.length();
		for(int j = 0; j < T.length(); j++){
			if(S.charAt(i+j)==T.charAt(j)) count--;
		}
		max = Math.min(count, max);
	}
		
	System.out.println(max);
	
	
	

    
  }
} import java.util.*; util.* java import java.io.*; io.* java import java.math.BigInteger; BigInteger java.math public class Main {
	public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	String S = s.next();
	String T = s.next();
	
	int max = T.length();
	for(int i = 0; i <= S.length()-T.length(); i++){
		int count = T.length();
		for(int j = 0; j < T.length(); j++){
			if(S.charAt(i+j)==T.charAt(j)) count--;
		}
		max = Math.min(count, max);
	}
		
	System.out.println(max);
	
	
	

    
  }
} Main public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	String S = s.next();
	String T = s.next();
	
	int max = T.length();
	for(int i = 0; i <= S.length()-T.length(); i++){
		int count = T.length();
		for(int j = 0; j < T.length(); j++){
			if(S.charAt(i+j)==T.charAt(j)) count--;
		}
		max = Math.min(count, max);
	}
		
	System.out.println(max);
	
	
	

    
  } main {
	Scanner s = new Scanner(System.in);
	String S = s.next();
	String T = s.next();
	
	int max = T.length();
	for(int i = 0; i <= S.length()-T.length(); i++){
		int count = T.length();
		for(int j = 0; j < T.length(); j++){
			if(S.charAt(i+j)==T.charAt(j)) count--;
		}
		max = Math.min(count, max);
	}
		
	System.out.println(max);
	
	
	

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

    
  }
} public class Main {
	public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	String S = s.next();
	String T = s.next();
	
	int max = T.length();
	for(int i = 0; i <= S.length()-T.length(); i++){
		int count = T.length();
		for(int j = 0; j < T.length(); j++){
			if(S.charAt(i+j)==T.charAt(j)) count--;
		}
		max = Math.min(count, max);
	}
		
	System.out.println(max);
	
	
	

    
  }
} Main
import java.util.*;
import java.io.*;
import java.math.BigInteger;
 
public class Main {
	public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	String S = s.next();
	String T = s.next();
	
	int max = T.length();
	for(int i = 0; i <= S.length()-T.length(); i++){
		int count = T.length();
		for(int j = 0; j < T.length(); j++){
			if(S.charAt(i+j)==T.charAt(j)) count--;
		}
		max = Math.min(count, max);
	}
		
	System.out.println(max);
	
	
	

    
  }
}