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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String a = sc.next();
        String b = sc.next();

        ArrayList<Integer> arr = new ArrayList<Integer>();

        int la = a.length();
        int lb = b.length();

        for (int i = 0; i < (la-lb+1);i++){
            String c = a.substring(i,i+lb);
            int cu = 0;
            for (int j = 0; j<lb;j++){
                if (c.charAt(j) != b.charAt(j))
                    cu++;
            }
            arr.add(cu);
        }
        System.out.println(Collections.min(arr));
    }
} import java.util.*; util.* java import java.io.*; io.* java import java.lang.*; lang.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String a = sc.next();
        String b = sc.next();

        ArrayList<Integer> arr = new ArrayList<Integer>();

        int la = a.length();
        int lb = b.length();

        for (int i = 0; i < (la-lb+1);i++){
            String c = a.substring(i,i+lb);
            int cu = 0;
            for (int j = 0; j<lb;j++){
                if (c.charAt(j) != b.charAt(j))
                    cu++;
            }
            arr.add(cu);
        }
        System.out.println(Collections.min(arr));
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String a = sc.next();
        String b = sc.next();

        ArrayList<Integer> arr = new ArrayList<Integer>();

        int la = a.length();
        int lb = b.length();

        for (int i = 0; i < (la-lb+1);i++){
            String c = a.substring(i,i+lb);
            int cu = 0;
            for (int j = 0; j<lb;j++){
                if (c.charAt(j) != b.charAt(j))
                    cu++;
            }
            arr.add(cu);
        }
        System.out.println(Collections.min(arr));
    } main {
        Scanner sc = new Scanner(System.in);

        String a = sc.next();
        String b = sc.next();

        ArrayList<Integer> arr = new ArrayList<Integer>();

        int la = a.length();
        int lb = b.length();

        for (int i = 0; i < (la-lb+1);i++){
            String c = a.substring(i,i+lb);
            int cu = 0;
            for (int j = 0; j<lb;j++){
                if (c.charAt(j) != b.charAt(j))
                    cu++;
            }
            arr.add(cu);
        }
        System.out.println(Collections.min(arr));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String a = sc.next(); a sc.next() sc.next sc String b = sc.next(); b sc.next() sc.next sc ArrayList<Integer> arr = new ArrayList<Integer>(); arr new ArrayList<Integer>() int la = a.length(); la a.length() a.length a int lb = b.length(); lb b.length() b.length b for (int i = 0; i < (la-lb+1);i++){
            String c = a.substring(i,i+lb);
            int cu = 0;
            for (int j = 0; j<lb;j++){
                if (c.charAt(j) != b.charAt(j))
                    cu++;
            }
            arr.add(cu);
        } int i = 0; int i = 0; i 0 i < (la-lb+1) i (la-lb+1) la-lb la lb 1 i++ i++ i {
            String c = a.substring(i,i+lb);
            int cu = 0;
            for (int j = 0; j<lb;j++){
                if (c.charAt(j) != b.charAt(j))
                    cu++;
            }
            arr.add(cu);
        } {
            String c = a.substring(i,i+lb);
            int cu = 0;
            for (int j = 0; j<lb;j++){
                if (c.charAt(j) != b.charAt(j))
                    cu++;
            }
            arr.add(cu);
        } String c = a.substring(i,i+lb); c a.substring(i,i+lb) a.substring a i i+lb i lb int cu = 0; cu 0 for (int j = 0; j<lb;j++){
                if (c.charAt(j) != b.charAt(j))
                    cu++;
            } int j = 0; int j = 0; j 0 j<lb j lb j++ j++ j {
                if (c.charAt(j) != b.charAt(j))
                    cu++;
            } {
                if (c.charAt(j) != b.charAt(j))
                    cu++;
            } if (c.charAt(j) != b.charAt(j))
                    cu++; c.charAt(j) != b.charAt(j) c.charAt(j) c.charAt c j b.charAt(j) b.charAt b j cu++ cu arr.add(cu) arr.add arr cu System.out.println(Collections.min(arr)) System.out.println System.out System System.out Collections.min(arr) Collections.min Collections arr String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String a = sc.next();
        String b = sc.next();

        ArrayList<Integer> arr = new ArrayList<Integer>();

        int la = a.length();
        int lb = b.length();

        for (int i = 0; i < (la-lb+1);i++){
            String c = a.substring(i,i+lb);
            int cu = 0;
            for (int j = 0; j<lb;j++){
                if (c.charAt(j) != b.charAt(j))
                    cu++;
            }
            arr.add(cu);
        }
        System.out.println(Collections.min(arr));
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String a = sc.next();
        String b = sc.next();

        ArrayList<Integer> arr = new ArrayList<Integer>();

        int la = a.length();
        int lb = b.length();

        for (int i = 0; i < (la-lb+1);i++){
            String c = a.substring(i,i+lb);
            int cu = 0;
            for (int j = 0; j<lb;j++){
                if (c.charAt(j) != b.charAt(j))
                    cu++;
            }
            arr.add(cu);
        }
        System.out.println(Collections.min(arr));
    }
} Main
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String a = sc.next();
        String b = sc.next();

        ArrayList<Integer> arr = new ArrayList<Integer>();

        int la = a.length();
        int lb = b.length();

        for (int i = 0; i < (la-lb+1);i++){
            String c = a.substring(i,i+lb);
            int cu = 0;
            for (int j = 0; j<lb;j++){
                if (c.charAt(j) != b.charAt(j))
                    cu++;
            }
            arr.add(cu);
        }
        System.out.println(Collections.min(arr));
    }
}