import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.nextLine();
        String T = scanner.nextLine();
        int min = Integer.MAX_VALUE;
        for(int i = 0; i<=S.length()-T.length(); i++){
            min = Math.min(min, find(S.substring(i, i+T.length()), T));
        }
        if(min!=Integer.MAX_VALUE){
            System.out.println(min);
        }else{
            System.out.println(T.length());
        }

    }

    public static int find(String a, String b){
        int calc = 0;
        for(int x = 0; x<a.length(); x++){
            if(a.charAt(x) != b.charAt(x)){
                calc++;
            }
        }
        return calc;
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.nextLine();
        String T = scanner.nextLine();
        int min = Integer.MAX_VALUE;
        for(int i = 0; i<=S.length()-T.length(); i++){
            min = Math.min(min, find(S.substring(i, i+T.length()), T));
        }
        if(min!=Integer.MAX_VALUE){
            System.out.println(min);
        }else{
            System.out.println(T.length());
        }

    }

    public static int find(String a, String b){
        int calc = 0;
        for(int x = 0; x<a.length(); x++){
            if(a.charAt(x) != b.charAt(x)){
                calc++;
            }
        }
        return calc;
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.nextLine();
        String T = scanner.nextLine();
        int min = Integer.MAX_VALUE;
        for(int i = 0; i<=S.length()-T.length(); i++){
            min = Math.min(min, find(S.substring(i, i+T.length()), T));
        }
        if(min!=Integer.MAX_VALUE){
            System.out.println(min);
        }else{
            System.out.println(T.length());
        }

    } main {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.nextLine();
        String T = scanner.nextLine();
        int min = Integer.MAX_VALUE;
        for(int i = 0; i<=S.length()-T.length(); i++){
            min = Math.min(min, find(S.substring(i, i+T.length()), T));
        }
        if(min!=Integer.MAX_VALUE){
            System.out.println(min);
        }else{
            System.out.println(T.length());
        }

    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String S = scanner.nextLine(); S scanner.nextLine() scanner.nextLine scanner String T = scanner.nextLine(); T scanner.nextLine() scanner.nextLine scanner int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i = 0; i<=S.length()-T.length(); i++){
            min = Math.min(min, find(S.substring(i, i+T.length()), T));
        } int i = 0; int i = 0; i 0 i<=S.length()-T.length() i S.length()-T.length() S.length() S.length S T.length() T.length T i++ i++ i {
            min = Math.min(min, find(S.substring(i, i+T.length()), T));
        } {
            min = Math.min(min, find(S.substring(i, i+T.length()), T));
        } min = Math.min(min, find(S.substring(i, i+T.length()), T)) min Math.min(min, find(S.substring(i, i+T.length()), T)) Math.min Math min find(S.substring(i, i+T.length()), T) find S.substring(i, i+T.length()) S.substring S i i+T.length() i T.length() T.length T T if(min!=Integer.MAX_VALUE){
            System.out.println(min);
        }else{
            System.out.println(T.length());
        } min!=Integer.MAX_VALUE min Integer.MAX_VALUE Integer Integer.MAX_VALUE {
            System.out.println(min);
        } System.out.println(min) System.out.println System.out System System.out min {
            System.out.println(T.length());
        } System.out.println(T.length()) System.out.println System.out System System.out T.length() T.length T String[] args args public static int find(String a, String b){
        int calc = 0;
        for(int x = 0; x<a.length(); x++){
            if(a.charAt(x) != b.charAt(x)){
                calc++;
            }
        }
        return calc;
    } find {
        int calc = 0;
        for(int x = 0; x<a.length(); x++){
            if(a.charAt(x) != b.charAt(x)){
                calc++;
            }
        }
        return calc;
    } int calc = 0; calc 0 for(int x = 0; x<a.length(); x++){
            if(a.charAt(x) != b.charAt(x)){
                calc++;
            }
        } int x = 0; int x = 0; x 0 x<a.length() x a.length() a.length a x++ x++ x {
            if(a.charAt(x) != b.charAt(x)){
                calc++;
            }
        } {
            if(a.charAt(x) != b.charAt(x)){
                calc++;
            }
        } if(a.charAt(x) != b.charAt(x)){
                calc++;
            } a.charAt(x) != b.charAt(x) a.charAt(x) a.charAt a x b.charAt(x) b.charAt b x {
                calc++;
            } calc++ calc return calc; calc String a a String b b public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.nextLine();
        String T = scanner.nextLine();
        int min = Integer.MAX_VALUE;
        for(int i = 0; i<=S.length()-T.length(); i++){
            min = Math.min(min, find(S.substring(i, i+T.length()), T));
        }
        if(min!=Integer.MAX_VALUE){
            System.out.println(min);
        }else{
            System.out.println(T.length());
        }

    }

    public static int find(String a, String b){
        int calc = 0;
        for(int x = 0; x<a.length(); x++){
            if(a.charAt(x) != b.charAt(x)){
                calc++;
            }
        }
        return calc;
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.nextLine();
        String T = scanner.nextLine();
        int min = Integer.MAX_VALUE;
        for(int i = 0; i<=S.length()-T.length(); i++){
            min = Math.min(min, find(S.substring(i, i+T.length()), T));
        }
        if(min!=Integer.MAX_VALUE){
            System.out.println(min);
        }else{
            System.out.println(T.length());
        }

    }

    public static int find(String a, String b){
        int calc = 0;
        for(int x = 0; x<a.length(); x++){
            if(a.charAt(x) != b.charAt(x)){
                calc++;
            }
        }
        return calc;
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.nextLine();
        String T = scanner.nextLine();
        int min = Integer.MAX_VALUE;
        for(int i = 0; i<=S.length()-T.length(); i++){
            min = Math.min(min, find(S.substring(i, i+T.length()), T));
        }
        if(min!=Integer.MAX_VALUE){
            System.out.println(min);
        }else{
            System.out.println(T.length());
        }

    }

    public static int find(String a, String b){
        int calc = 0;
        for(int x = 0; x<a.length(); x++){
            if(a.charAt(x) != b.charAt(x)){
                calc++;
            }
        }
        return calc;
    }
}
