import java.util.*; 
import java.lang.*; 


public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                String S = scan.next();
                String T = scan.next();
               
                int nagasa = T.length();
                
                int ans = 10000;
                
                for(int i=0; i<=S.length()-nagasa; i++){
                    int kotonaru = 0;
                    int cnt=0;
                    while(cnt<T.length()){
                        if(S.charAt(i+cnt)!=T.charAt(cnt)){
                            kotonaru++;
                        }
                        cnt++;
                    }
                
                    ans = Math.min(kotonaru, ans);
                }
                
                System.out.println(ans);
        }
} import java.util.*; util.* java import java.lang.*; lang.* java public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                String S = scan.next();
                String T = scan.next();
               
                int nagasa = T.length();
                
                int ans = 10000;
                
                for(int i=0; i<=S.length()-nagasa; i++){
                    int kotonaru = 0;
                    int cnt=0;
                    while(cnt<T.length()){
                        if(S.charAt(i+cnt)!=T.charAt(cnt)){
                            kotonaru++;
                        }
                        cnt++;
                    }
                
                    ans = Math.min(kotonaru, ans);
                }
                
                System.out.println(ans);
        }
} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                String S = scan.next();
                String T = scan.next();
               
                int nagasa = T.length();
                
                int ans = 10000;
                
                for(int i=0; i<=S.length()-nagasa; i++){
                    int kotonaru = 0;
                    int cnt=0;
                    while(cnt<T.length()){
                        if(S.charAt(i+cnt)!=T.charAt(cnt)){
                            kotonaru++;
                        }
                        cnt++;
                    }
                
                    ans = Math.min(kotonaru, ans);
                }
                
                System.out.println(ans);
        } main {
		Scanner scan = new Scanner(System.in);
                
                String S = scan.next();
                String T = scan.next();
               
                int nagasa = T.length();
                
                int ans = 10000;
                
                for(int i=0; i<=S.length()-nagasa; i++){
                    int kotonaru = 0;
                    int cnt=0;
                    while(cnt<T.length()){
                        if(S.charAt(i+cnt)!=T.charAt(cnt)){
                            kotonaru++;
                        }
                        cnt++;
                    }
                
                    ans = Math.min(kotonaru, ans);
                }
                
                System.out.println(ans);
        } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String S = scan.next(); S scan.next() scan.next scan String T = scan.next(); T scan.next() scan.next scan int nagasa = T.length(); nagasa T.length() T.length T int ans = 10000; ans 10000 for(int i=0; i<=S.length()-nagasa; i++){
                    int kotonaru = 0;
                    int cnt=0;
                    while(cnt<T.length()){
                        if(S.charAt(i+cnt)!=T.charAt(cnt)){
                            kotonaru++;
                        }
                        cnt++;
                    }
                
                    ans = Math.min(kotonaru, ans);
                } int i=0; int i=0; i 0 i<=S.length()-nagasa i S.length()-nagasa S.length() S.length S nagasa i++ i++ i {
                    int kotonaru = 0;
                    int cnt=0;
                    while(cnt<T.length()){
                        if(S.charAt(i+cnt)!=T.charAt(cnt)){
                            kotonaru++;
                        }
                        cnt++;
                    }
                
                    ans = Math.min(kotonaru, ans);
                } {
                    int kotonaru = 0;
                    int cnt=0;
                    while(cnt<T.length()){
                        if(S.charAt(i+cnt)!=T.charAt(cnt)){
                            kotonaru++;
                        }
                        cnt++;
                    }
                
                    ans = Math.min(kotonaru, ans);
                } int kotonaru = 0; kotonaru 0 int cnt=0; cnt 0 while(cnt<T.length()){
                        if(S.charAt(i+cnt)!=T.charAt(cnt)){
                            kotonaru++;
                        }
                        cnt++;
                    } cnt<T.length() cnt T.length() T.length T {
                        if(S.charAt(i+cnt)!=T.charAt(cnt)){
                            kotonaru++;
                        }
                        cnt++;
                    } if(S.charAt(i+cnt)!=T.charAt(cnt)){
                            kotonaru++;
                        } S.charAt(i+cnt)!=T.charAt(cnt) S.charAt(i+cnt) S.charAt S i+cnt i cnt T.charAt(cnt) T.charAt T cnt {
                            kotonaru++;
                        } kotonaru++ kotonaru cnt++ cnt ans = Math.min(kotonaru, ans) ans Math.min(kotonaru, ans) Math.min Math kotonaru ans 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){
		Scanner scan = new Scanner(System.in);
                
                String S = scan.next();
                String T = scan.next();
               
                int nagasa = T.length();
                
                int ans = 10000;
                
                for(int i=0; i<=S.length()-nagasa; i++){
                    int kotonaru = 0;
                    int cnt=0;
                    while(cnt<T.length()){
                        if(S.charAt(i+cnt)!=T.charAt(cnt)){
                            kotonaru++;
                        }
                        cnt++;
                    }
                
                    ans = Math.min(kotonaru, ans);
                }
                
                System.out.println(ans);
        }
} public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                String S = scan.next();
                String T = scan.next();
               
                int nagasa = T.length();
                
                int ans = 10000;
                
                for(int i=0; i<=S.length()-nagasa; i++){
                    int kotonaru = 0;
                    int cnt=0;
                    while(cnt<T.length()){
                        if(S.charAt(i+cnt)!=T.charAt(cnt)){
                            kotonaru++;
                        }
                        cnt++;
                    }
                
                    ans = Math.min(kotonaru, ans);
                }
                
                System.out.println(ans);
        }
} Main
import java.util.*; 
import java.lang.*; 


public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                String S = scan.next();
                String T = scan.next();
               
                int nagasa = T.length();
                
                int ans = 10000;
                
                for(int i=0; i<=S.length()-nagasa; i++){
                    int kotonaru = 0;
                    int cnt=0;
                    while(cnt<T.length()){
                        if(S.charAt(i+cnt)!=T.charAt(cnt)){
                            kotonaru++;
                        }
                        cnt++;
                    }
                
                    ans = Math.min(kotonaru, ans);
                }
                
                System.out.println(ans);
        }
}