import java.util.*;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str1 = sc.nextLine();
        String str2 = sc.nextLine();
        int n1 = str1.length();
        int n2 = str2.length();
        int min_count = Integer.MAX_VALUE,count = 0;
        for(int i = 0;i<=n1-n2;i++){
            if(str1.substring(i,i+n2).equals(str2)){
                min_count = 0;
                break;
            }
            else{
                count = 0;
                for(int j = i;j<i+n2;j++){
                    if(str1.charAt(j) != str2.charAt(j-i))
                        count++;
                }    
            }
            min_count = Math.min(count,min_count);
            //System.out.print(min_count + " ");
        }
        //System.out.println();
        System.out.println(min_count);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str1 = sc.nextLine();
        String str2 = sc.nextLine();
        int n1 = str1.length();
        int n2 = str2.length();
        int min_count = Integer.MAX_VALUE,count = 0;
        for(int i = 0;i<=n1-n2;i++){
            if(str1.substring(i,i+n2).equals(str2)){
                min_count = 0;
                break;
            }
            else{
                count = 0;
                for(int j = i;j<i+n2;j++){
                    if(str1.charAt(j) != str2.charAt(j-i))
                        count++;
                }    
            }
            min_count = Math.min(count,min_count);
            //System.out.print(min_count + " ");
        }
        //System.out.println();
        System.out.println(min_count);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str1 = sc.nextLine();
        String str2 = sc.nextLine();
        int n1 = str1.length();
        int n2 = str2.length();
        int min_count = Integer.MAX_VALUE,count = 0;
        for(int i = 0;i<=n1-n2;i++){
            if(str1.substring(i,i+n2).equals(str2)){
                min_count = 0;
                break;
            }
            else{
                count = 0;
                for(int j = i;j<i+n2;j++){
                    if(str1.charAt(j) != str2.charAt(j-i))
                        count++;
                }    
            }
            min_count = Math.min(count,min_count);
            //System.out.print(min_count + " ");
        }
        //System.out.println();
        System.out.println(min_count);
    } main {
        Scanner sc = new Scanner(System.in);
        String str1 = sc.nextLine();
        String str2 = sc.nextLine();
        int n1 = str1.length();
        int n2 = str2.length();
        int min_count = Integer.MAX_VALUE,count = 0;
        for(int i = 0;i<=n1-n2;i++){
            if(str1.substring(i,i+n2).equals(str2)){
                min_count = 0;
                break;
            }
            else{
                count = 0;
                for(int j = i;j<i+n2;j++){
                    if(str1.charAt(j) != str2.charAt(j-i))
                        count++;
                }    
            }
            min_count = Math.min(count,min_count);
            //System.out.print(min_count + " ");
        }
        //System.out.println();
        System.out.println(min_count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str1 = sc.nextLine(); str1 sc.nextLine() sc.nextLine sc String str2 = sc.nextLine(); str2 sc.nextLine() sc.nextLine sc int n1 = str1.length(); n1 str1.length() str1.length str1 int n2 = str2.length(); n2 str2.length() str2.length str2 int min_count = Integer.MAX_VALUE min_count Integer.MAX_VALUE Integer Integer.MAX_VALUE count = 0; count 0 for(int i = 0;i<=n1-n2;i++){
            if(str1.substring(i,i+n2).equals(str2)){
                min_count = 0;
                break;
            }
            else{
                count = 0;
                for(int j = i;j<i+n2;j++){
                    if(str1.charAt(j) != str2.charAt(j-i))
                        count++;
                }    
            }
            min_count = Math.min(count,min_count);
            //System.out.print(min_count + " ");
        } int i = 0; int i = 0; i 0 i<=n1-n2 i n1-n2 n1 n2 i++ i++ i {
            if(str1.substring(i,i+n2).equals(str2)){
                min_count = 0;
                break;
            }
            else{
                count = 0;
                for(int j = i;j<i+n2;j++){
                    if(str1.charAt(j) != str2.charAt(j-i))
                        count++;
                }    
            }
            min_count = Math.min(count,min_count);
            //System.out.print(min_count + " ");
        } {
            if(str1.substring(i,i+n2).equals(str2)){
                min_count = 0;
                break;
            }
            else{
                count = 0;
                for(int j = i;j<i+n2;j++){
                    if(str1.charAt(j) != str2.charAt(j-i))
                        count++;
                }    
            }
            min_count = Math.min(count,min_count);
            //System.out.print(min_count + " ");
        } if(str1.substring(i,i+n2).equals(str2)){
                min_count = 0;
                break;
            }
            else{
                count = 0;
                for(int j = i;j<i+n2;j++){
                    if(str1.charAt(j) != str2.charAt(j-i))
                        count++;
                }    
            } str1.substring(i,i+n2).equals(str2) str1.substring(i,i+n2).equals str1.substring(i,i+n2) str1.substring str1 i i+n2 i n2 str2 {
                min_count = 0;
                break;
            } min_count = 0 min_count 0 break; {
                count = 0;
                for(int j = i;j<i+n2;j++){
                    if(str1.charAt(j) != str2.charAt(j-i))
                        count++;
                }    
            } count = 0 count 0 for(int j = i;j<i+n2;j++){
                    if(str1.charAt(j) != str2.charAt(j-i))
                        count++;
                } int j = i; int j = i; j i j<i+n2 j i+n2 i n2 j++ j++ j {
                    if(str1.charAt(j) != str2.charAt(j-i))
                        count++;
                } {
                    if(str1.charAt(j) != str2.charAt(j-i))
                        count++;
                } if(str1.charAt(j) != str2.charAt(j-i))
                        count++; str1.charAt(j) != str2.charAt(j-i) str1.charAt(j) str1.charAt str1 j str2.charAt(j-i) str2.charAt str2 j-i j i count++ count min_count = Math.min(count,min_count) min_count Math.min(count,min_count) Math.min Math count min_count System.out.println(min_count) System.out.println System.out System System.out min_count String[] args args public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str1 = sc.nextLine();
        String str2 = sc.nextLine();
        int n1 = str1.length();
        int n2 = str2.length();
        int min_count = Integer.MAX_VALUE,count = 0;
        for(int i = 0;i<=n1-n2;i++){
            if(str1.substring(i,i+n2).equals(str2)){
                min_count = 0;
                break;
            }
            else{
                count = 0;
                for(int j = i;j<i+n2;j++){
                    if(str1.charAt(j) != str2.charAt(j-i))
                        count++;
                }    
            }
            min_count = Math.min(count,min_count);
            //System.out.print(min_count + " ");
        }
        //System.out.println();
        System.out.println(min_count);
    }
} public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str1 = sc.nextLine();
        String str2 = sc.nextLine();
        int n1 = str1.length();
        int n2 = str2.length();
        int min_count = Integer.MAX_VALUE,count = 0;
        for(int i = 0;i<=n1-n2;i++){
            if(str1.substring(i,i+n2).equals(str2)){
                min_count = 0;
                break;
            }
            else{
                count = 0;
                for(int j = i;j<i+n2;j++){
                    if(str1.charAt(j) != str2.charAt(j-i))
                        count++;
                }    
            }
            min_count = Math.min(count,min_count);
            //System.out.print(min_count + " ");
        }
        //System.out.println();
        System.out.println(min_count);
    }
} Main
import java.util.*;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str1 = sc.nextLine();
        String str2 = sc.nextLine();
        int n1 = str1.length();
        int n2 = str2.length();
        int min_count = Integer.MAX_VALUE,count = 0;
        for(int i = 0;i<=n1-n2;i++){
            if(str1.substring(i,i+n2).equals(str2)){
                min_count = 0;
                break;
            }
            else{
                count = 0;
                for(int j = i;j<i+n2;j++){
                    if(str1.charAt(j) != str2.charAt(j-i))
                        count++;
                }    
            }
            min_count = Math.min(count,min_count);
            //System.out.print(min_count + " ");
        }
        //System.out.println();
        System.out.println(min_count);
    }
}