import java.util.Scanner;
import java.time.Year;
import java.util.Random;
import java.math.*;

public class Main{
    public static void main(String[] args){
        Scanner sc =new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        String s2="";
        int s_length = s.length();
        int t_length = t.length();
        int count = 0;
        int max=0;
        for(int i = 0;i<(s_length-t_length+1);i++){
            s2=s.substring(i, t_length+i);  
            for(int j=0;j<t_length;j++){
                if(s2.charAt(j)==t.charAt(j)){
                    count++;
                    if(max<count){
                        max = count;
                    }
                }
            }count=0;
        }
    System.out.println(t_length-max);    
    }
} import java.util.Scanner; Scanner java.util import java.time.Year; Year java.time import java.util.Random; Random java.util import java.math.*; math.* java public class Main{
    public static void main(String[] args){
        Scanner sc =new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        String s2="";
        int s_length = s.length();
        int t_length = t.length();
        int count = 0;
        int max=0;
        for(int i = 0;i<(s_length-t_length+1);i++){
            s2=s.substring(i, t_length+i);  
            for(int j=0;j<t_length;j++){
                if(s2.charAt(j)==t.charAt(j)){
                    count++;
                    if(max<count){
                        max = count;
                    }
                }
            }count=0;
        }
    System.out.println(t_length-max);    
    }
} Main public static void main(String[] args){
        Scanner sc =new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        String s2="";
        int s_length = s.length();
        int t_length = t.length();
        int count = 0;
        int max=0;
        for(int i = 0;i<(s_length-t_length+1);i++){
            s2=s.substring(i, t_length+i);  
            for(int j=0;j<t_length;j++){
                if(s2.charAt(j)==t.charAt(j)){
                    count++;
                    if(max<count){
                        max = count;
                    }
                }
            }count=0;
        }
    System.out.println(t_length-max);    
    } main {
        Scanner sc =new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        String s2="";
        int s_length = s.length();
        int t_length = t.length();
        int count = 0;
        int max=0;
        for(int i = 0;i<(s_length-t_length+1);i++){
            s2=s.substring(i, t_length+i);  
            for(int j=0;j<t_length;j++){
                if(s2.charAt(j)==t.charAt(j)){
                    count++;
                    if(max<count){
                        max = count;
                    }
                }
            }count=0;
        }
    System.out.println(t_length-max);    
    } 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 String s2=""; s2 "" int s_length = s.length(); s_length s.length() s.length s int t_length = t.length(); t_length t.length() t.length t int count = 0; count 0 int max=0; max 0 for(int i = 0;i<(s_length-t_length+1);i++){
            s2=s.substring(i, t_length+i);  
            for(int j=0;j<t_length;j++){
                if(s2.charAt(j)==t.charAt(j)){
                    count++;
                    if(max<count){
                        max = count;
                    }
                }
            }count=0;
        } 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 t_length 1 i++ i++ i {
            s2=s.substring(i, t_length+i);  
            for(int j=0;j<t_length;j++){
                if(s2.charAt(j)==t.charAt(j)){
                    count++;
                    if(max<count){
                        max = count;
                    }
                }
            }count=0;
        } {
            s2=s.substring(i, t_length+i);  
            for(int j=0;j<t_length;j++){
                if(s2.charAt(j)==t.charAt(j)){
                    count++;
                    if(max<count){
                        max = count;
                    }
                }
            }count=0;
        } s2=s.substring(i, t_length+i) s2 s.substring(i, t_length+i) s.substring s i t_length+i t_length i for(int j=0;j<t_length;j++){
                if(s2.charAt(j)==t.charAt(j)){
                    count++;
                    if(max<count){
                        max = count;
                    }
                }
            } int j=0; int j=0; j 0 j<t_length j t_length j++ j++ j {
                if(s2.charAt(j)==t.charAt(j)){
                    count++;
                    if(max<count){
                        max = count;
                    }
                }
            } {
                if(s2.charAt(j)==t.charAt(j)){
                    count++;
                    if(max<count){
                        max = count;
                    }
                }
            } if(s2.charAt(j)==t.charAt(j)){
                    count++;
                    if(max<count){
                        max = count;
                    }
                } s2.charAt(j)==t.charAt(j) s2.charAt(j) s2.charAt s2 j t.charAt(j) t.charAt t j {
                    count++;
                    if(max<count){
                        max = count;
                    }
                } count++ count if(max<count){
                        max = count;
                    } max<count max count {
                        max = count;
                    } max = count max count count=0 count 0 System.out.println(t_length-max) System.out.println System.out System System.out t_length-max t_length max String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc =new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        String s2="";
        int s_length = s.length();
        int t_length = t.length();
        int count = 0;
        int max=0;
        for(int i = 0;i<(s_length-t_length+1);i++){
            s2=s.substring(i, t_length+i);  
            for(int j=0;j<t_length;j++){
                if(s2.charAt(j)==t.charAt(j)){
                    count++;
                    if(max<count){
                        max = count;
                    }
                }
            }count=0;
        }
    System.out.println(t_length-max);    
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc =new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        String s2="";
        int s_length = s.length();
        int t_length = t.length();
        int count = 0;
        int max=0;
        for(int i = 0;i<(s_length-t_length+1);i++){
            s2=s.substring(i, t_length+i);  
            for(int j=0;j<t_length;j++){
                if(s2.charAt(j)==t.charAt(j)){
                    count++;
                    if(max<count){
                        max = count;
                    }
                }
            }count=0;
        }
    System.out.println(t_length-max);    
    }
} Main
import java.util.Scanner;
import java.time.Year;
import java.util.Random;
import java.math.*;

public class Main{
    public static void main(String[] args){
        Scanner sc =new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        String s2="";
        int s_length = s.length();
        int t_length = t.length();
        int count = 0;
        int max=0;
        for(int i = 0;i<(s_length-t_length+1);i++){
            s2=s.substring(i, t_length+i);  
            for(int j=0;j<t_length;j++){
                if(s2.charAt(j)==t.charAt(j)){
                    count++;
                    if(max<count){
                        max = count;
                    }
                }
            }count=0;
        }
    System.out.println(t_length-max);    
    }
}