import java.util.*;
 
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		String s1 = sc.next();
        String s2 = sc.next();
        int min = s2.length();
        for(int i = 0; i <= s1.length() - s2.length(); i++){
        	String s3 = s1.substring(i, i + s2.length());
            int count = 0;
            for(int j = 0; j < s2.length(); j++){
            	if(s2.charAt(j) != s3.charAt(j)){
                	count++;
                }
            }
            min = Math.min(min, count);
        }
        System.out.println(min);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		String s1 = sc.next();
        String s2 = sc.next();
        int min = s2.length();
        for(int i = 0; i <= s1.length() - s2.length(); i++){
        	String s3 = s1.substring(i, i + s2.length());
            int count = 0;
            for(int j = 0; j < s2.length(); j++){
            	if(s2.charAt(j) != s3.charAt(j)){
                	count++;
                }
            }
            min = Math.min(min, count);
        }
        System.out.println(min);
	}
} Main public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		String s1 = sc.next();
        String s2 = sc.next();
        int min = s2.length();
        for(int i = 0; i <= s1.length() - s2.length(); i++){
        	String s3 = s1.substring(i, i + s2.length());
            int count = 0;
            for(int j = 0; j < s2.length(); j++){
            	if(s2.charAt(j) != s3.charAt(j)){
                	count++;
                }
            }
            min = Math.min(min, count);
        }
        System.out.println(min);
	} main {
		Scanner sc = new Scanner(System.in);
		String s1 = sc.next();
        String s2 = sc.next();
        int min = s2.length();
        for(int i = 0; i <= s1.length() - s2.length(); i++){
        	String s3 = s1.substring(i, i + s2.length());
            int count = 0;
            for(int j = 0; j < s2.length(); j++){
            	if(s2.charAt(j) != s3.charAt(j)){
                	count++;
                }
            }
            min = Math.min(min, count);
        }
        System.out.println(min);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s1 = sc.next(); s1 sc.next() sc.next sc String s2 = sc.next(); s2 sc.next() sc.next sc int min = s2.length(); min s2.length() s2.length s2 for(int i = 0; i <= s1.length() - s2.length(); i++){
        	String s3 = s1.substring(i, i + s2.length());
            int count = 0;
            for(int j = 0; j < s2.length(); j++){
            	if(s2.charAt(j) != s3.charAt(j)){
                	count++;
                }
            }
            min = Math.min(min, count);
        } int i = 0; int i = 0; i 0 i <= s1.length() - s2.length() i s1.length() - s2.length() s1.length() s1.length s1 s2.length() s2.length s2 i++ i++ i {
        	String s3 = s1.substring(i, i + s2.length());
            int count = 0;
            for(int j = 0; j < s2.length(); j++){
            	if(s2.charAt(j) != s3.charAt(j)){
                	count++;
                }
            }
            min = Math.min(min, count);
        } {
        	String s3 = s1.substring(i, i + s2.length());
            int count = 0;
            for(int j = 0; j < s2.length(); j++){
            	if(s2.charAt(j) != s3.charAt(j)){
                	count++;
                }
            }
            min = Math.min(min, count);
        } String s3 = s1.substring(i, i + s2.length()); s3 s1.substring(i, i + s2.length()) s1.substring s1 i i + s2.length() i s2.length() s2.length s2 int count = 0; count 0 for(int j = 0; j < s2.length(); j++){
            	if(s2.charAt(j) != s3.charAt(j)){
                	count++;
                }
            } int j = 0; int j = 0; j 0 j < s2.length() j s2.length() s2.length s2 j++ j++ j {
            	if(s2.charAt(j) != s3.charAt(j)){
                	count++;
                }
            } {
            	if(s2.charAt(j) != s3.charAt(j)){
                	count++;
                }
            } if(s2.charAt(j) != s3.charAt(j)){
                	count++;
                } s2.charAt(j) != s3.charAt(j) s2.charAt(j) s2.charAt s2 j s3.charAt(j) s3.charAt s3 j {
                	count++;
                } count++ count min = Math.min(min, count) min Math.min(min, count) Math.min Math min count System.out.println(min) System.out.println System.out System System.out min String[] args args public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		String s1 = sc.next();
        String s2 = sc.next();
        int min = s2.length();
        for(int i = 0; i <= s1.length() - s2.length(); i++){
        	String s3 = s1.substring(i, i + s2.length());
            int count = 0;
            for(int j = 0; j < s2.length(); j++){
            	if(s2.charAt(j) != s3.charAt(j)){
                	count++;
                }
            }
            min = Math.min(min, count);
        }
        System.out.println(min);
	}
} public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		String s1 = sc.next();
        String s2 = sc.next();
        int min = s2.length();
        for(int i = 0; i <= s1.length() - s2.length(); i++){
        	String s3 = s1.substring(i, i + s2.length());
            int count = 0;
            for(int j = 0; j < s2.length(); j++){
            	if(s2.charAt(j) != s3.charAt(j)){
                	count++;
                }
            }
            min = Math.min(min, count);
        }
        System.out.println(min);
	}
} Main
import java.util.*;
 
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		String s1 = sc.next();
        String s2 = sc.next();
        int min = s2.length();
        for(int i = 0; i <= s1.length() - s2.length(); i++){
        	String s3 = s1.substring(i, i + s2.length());
            int count = 0;
            for(int j = 0; j < s2.length(); j++){
            	if(s2.charAt(j) != s3.charAt(j)){
                	count++;
                }
            }
            min = Math.min(min, count);
        }
        System.out.println(min);
	}
}