import java.util.Map.Entry;
import java.lang.reflect.Method;
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.ArrayList;

//import org.w3c.dom.css.Counter;


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 ans =999999;
		for(int i=0;i<S.length()-T.length()+1;i++){
			int tmp=0;
			for(int i2=0;i2<T.length();i2++){
				if(T.charAt(i2)!=S.charAt(i2+i)){
                    tmp++;
                }
			}
			if(ans>tmp){ans=tmp;}
		}
        System.out.println(ans);
    }
} import java.util.Map.Entry; Entry java.util.Map import java.lang.reflect.Method; Method java.lang.reflect import java.util.*; util.* java import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayDeque; ArrayDeque java.util import java.util.Arrays; Arrays java.util import java.util.Deque; Deque java.util import java.util.ArrayList; ArrayList java.util 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 ans =999999;
		for(int i=0;i<S.length()-T.length()+1;i++){
			int tmp=0;
			for(int i2=0;i2<T.length();i2++){
				if(T.charAt(i2)!=S.charAt(i2+i)){
                    tmp++;
                }
			}
			if(ans>tmp){ans=tmp;}
		}
        System.out.println(ans);
    }
} Main public static void main(String[] args)throws Exception{
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
        String T = sc.next();
        int ans =999999;
		for(int i=0;i<S.length()-T.length()+1;i++){
			int tmp=0;
			for(int i2=0;i2<T.length();i2++){
				if(T.charAt(i2)!=S.charAt(i2+i)){
                    tmp++;
                }
			}
			if(ans>tmp){ans=tmp;}
		}
        System.out.println(ans);
    } main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
        String T = sc.next();
        int ans =999999;
		for(int i=0;i<S.length()-T.length()+1;i++){
			int tmp=0;
			for(int i2=0;i2<T.length();i2++){
				if(T.charAt(i2)!=S.charAt(i2+i)){
                    tmp++;
                }
			}
			if(ans>tmp){ans=tmp;}
		}
        System.out.println(ans);
    } 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 ans =999999; ans 999999 for(int i=0;i<S.length()-T.length()+1;i++){
			int tmp=0;
			for(int i2=0;i2<T.length();i2++){
				if(T.charAt(i2)!=S.charAt(i2+i)){
                    tmp++;
                }
			}
			if(ans>tmp){ans=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 i2=0;i2<T.length();i2++){
				if(T.charAt(i2)!=S.charAt(i2+i)){
                    tmp++;
                }
			}
			if(ans>tmp){ans=tmp;}
		} {
			int tmp=0;
			for(int i2=0;i2<T.length();i2++){
				if(T.charAt(i2)!=S.charAt(i2+i)){
                    tmp++;
                }
			}
			if(ans>tmp){ans=tmp;}
		} int tmp=0; tmp 0 for(int i2=0;i2<T.length();i2++){
				if(T.charAt(i2)!=S.charAt(i2+i)){
                    tmp++;
                }
			} int i2=0; int i2=0; i2 0 i2<T.length() i2 T.length() T.length T i2++ i2++ i2 {
				if(T.charAt(i2)!=S.charAt(i2+i)){
                    tmp++;
                }
			} {
				if(T.charAt(i2)!=S.charAt(i2+i)){
                    tmp++;
                }
			} if(T.charAt(i2)!=S.charAt(i2+i)){
                    tmp++;
                } T.charAt(i2)!=S.charAt(i2+i) T.charAt(i2) T.charAt T i2 S.charAt(i2+i) S.charAt S i2+i i2 i {
                    tmp++;
                } tmp++ tmp if(ans>tmp){ans=tmp;} ans>tmp ans tmp {ans=tmp;} ans=tmp ans tmp System.out.println(ans) System.out.println System.out System System.out ans String[] args args 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 ans =999999;
		for(int i=0;i<S.length()-T.length()+1;i++){
			int tmp=0;
			for(int i2=0;i2<T.length();i2++){
				if(T.charAt(i2)!=S.charAt(i2+i)){
                    tmp++;
                }
			}
			if(ans>tmp){ans=tmp;}
		}
        System.out.println(ans);
    }
} 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 ans =999999;
		for(int i=0;i<S.length()-T.length()+1;i++){
			int tmp=0;
			for(int i2=0;i2<T.length();i2++){
				if(T.charAt(i2)!=S.charAt(i2+i)){
                    tmp++;
                }
			}
			if(ans>tmp){ans=tmp;}
		}
        System.out.println(ans);
    }
} Main
import java.util.Map.Entry;
import java.lang.reflect.Method;
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.ArrayList;

//import org.w3c.dom.css.Counter;


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 ans =999999;
		for(int i=0;i<S.length()-T.length()+1;i++){
			int tmp=0;
			for(int i2=0;i2<T.length();i2++){
				if(T.charAt(i2)!=S.charAt(i2+i)){
                    tmp++;
                }
			}
			if(ans>tmp){ans=tmp;}
		}
        System.out.println(ans);
    }
}