import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = sc.nextLine();
        int diff = S.length() - T.length();
        int min = Integer.MAX_VALUE;
        for(int i = 0;i<diff+1;i++){
            int temp = T.length();
            for(int j = 0;j<T.length();j++){
                if(S.charAt(i+j) == T.charAt(j)){
                    temp--;
                }
            }
            min = Math.min(min,temp);
        }
        System.out.println(min);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = sc.nextLine();
        int diff = S.length() - T.length();
        int min = Integer.MAX_VALUE;
        for(int i = 0;i<diff+1;i++){
            int temp = T.length();
            for(int j = 0;j<T.length();j++){
                if(S.charAt(i+j) == T.charAt(j)){
                    temp--;
                }
            }
            min = Math.min(min,temp);
        }
        System.out.println(min);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = sc.nextLine();
        int diff = S.length() - T.length();
        int min = Integer.MAX_VALUE;
        for(int i = 0;i<diff+1;i++){
            int temp = T.length();
            for(int j = 0;j<T.length();j++){
                if(S.charAt(i+j) == T.charAt(j)){
                    temp--;
                }
            }
            min = Math.min(min,temp);
        }
        System.out.println(min);
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = sc.nextLine();
        int diff = S.length() - T.length();
        int min = Integer.MAX_VALUE;
        for(int i = 0;i<diff+1;i++){
            int temp = T.length();
            for(int j = 0;j<T.length();j++){
                if(S.charAt(i+j) == T.charAt(j)){
                    temp--;
                }
            }
            min = Math.min(min,temp);
        }
        System.out.println(min);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.nextLine(); S sc.nextLine() sc.nextLine sc String T = sc.nextLine(); T sc.nextLine() sc.nextLine sc int diff = S.length() - T.length(); diff S.length() - T.length() S.length() S.length S T.length() T.length T int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i = 0;i<diff+1;i++){
            int temp = T.length();
            for(int j = 0;j<T.length();j++){
                if(S.charAt(i+j) == T.charAt(j)){
                    temp--;
                }
            }
            min = Math.min(min,temp);
        } int i = 0; int i = 0; i 0 i<diff+1 i diff+1 diff 1 i++ i++ i {
            int temp = T.length();
            for(int j = 0;j<T.length();j++){
                if(S.charAt(i+j) == T.charAt(j)){
                    temp--;
                }
            }
            min = Math.min(min,temp);
        } {
            int temp = T.length();
            for(int j = 0;j<T.length();j++){
                if(S.charAt(i+j) == T.charAt(j)){
                    temp--;
                }
            }
            min = Math.min(min,temp);
        } int temp = T.length(); temp T.length() T.length T for(int j = 0;j<T.length();j++){
                if(S.charAt(i+j) == T.charAt(j)){
                    temp--;
                }
            } int j = 0; int j = 0; j 0 j<T.length() j T.length() T.length T j++ j++ j {
                if(S.charAt(i+j) == T.charAt(j)){
                    temp--;
                }
            } {
                if(S.charAt(i+j) == T.charAt(j)){
                    temp--;
                }
            } if(S.charAt(i+j) == T.charAt(j)){
                    temp--;
                } S.charAt(i+j) == T.charAt(j) S.charAt(i+j) S.charAt S i+j i j T.charAt(j) T.charAt T j {
                    temp--;
                } temp-- temp min = Math.min(min,temp) min Math.min(min,temp) Math.min Math min temp 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) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = sc.nextLine();
        int diff = S.length() - T.length();
        int min = Integer.MAX_VALUE;
        for(int i = 0;i<diff+1;i++){
            int temp = T.length();
            for(int j = 0;j<T.length();j++){
                if(S.charAt(i+j) == T.charAt(j)){
                    temp--;
                }
            }
            min = Math.min(min,temp);
        }
        System.out.println(min);
    }
} public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = sc.nextLine();
        int diff = S.length() - T.length();
        int min = Integer.MAX_VALUE;
        for(int i = 0;i<diff+1;i++){
            int temp = T.length();
            for(int j = 0;j<T.length();j++){
                if(S.charAt(i+j) == T.charAt(j)){
                    temp--;
                }
            }
            min = Math.min(min,temp);
        }
        System.out.println(min);
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = sc.nextLine();
        int diff = S.length() - T.length();
        int min = Integer.MAX_VALUE;
        for(int i = 0;i<diff+1;i++){
            int temp = T.length();
            for(int j = 0;j<T.length();j++){
                if(S.charAt(i+j) == T.charAt(j)){
                    temp--;
                }
            }
            min = Math.min(min,temp);
        }
        System.out.println(min);
    }
}