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

public class Main {
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static StringTokenizer st;

    public static void main(String[] args) throws IOException {
        String S = br.readLine();
        String T = br.readLine();

        int res = T.length();
        for (int i = 0; i <= S.length() - T.length(); i++) {
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                if (S.charAt(i + j) != T.charAt(j)) count++;
            }
            res = Math.min(res, count);
        }
        System.out.println(res);
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static StringTokenizer st;

    public static void main(String[] args) throws IOException {
        String S = br.readLine();
        String T = br.readLine();

        int res = T.length();
        for (int i = 0; i <= S.length() - T.length(); i++) {
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                if (S.charAt(i + j) != T.charAt(j)) count++;
            }
            res = Math.min(res, count);
        }
        System.out.println(res);
    }
} Main private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) private static StringTokenizer st; st public static void main(String[] args) throws IOException {
        String S = br.readLine();
        String T = br.readLine();

        int res = T.length();
        for (int i = 0; i <= S.length() - T.length(); i++) {
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                if (S.charAt(i + j) != T.charAt(j)) count++;
            }
            res = Math.min(res, count);
        }
        System.out.println(res);
    } main {
        String S = br.readLine();
        String T = br.readLine();

        int res = T.length();
        for (int i = 0; i <= S.length() - T.length(); i++) {
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                if (S.charAt(i + j) != T.charAt(j)) count++;
            }
            res = Math.min(res, count);
        }
        System.out.println(res);
    } String S = br.readLine(); S br.readLine() br.readLine br String T = br.readLine(); T br.readLine() br.readLine br int res = T.length(); res T.length() T.length T for (int i = 0; i <= S.length() - T.length(); i++) {
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                if (S.charAt(i + j) != T.charAt(j)) count++;
            }
            res = Math.min(res, count);
        } 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 {
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                if (S.charAt(i + j) != T.charAt(j)) count++;
            }
            res = Math.min(res, count);
        } {
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                if (S.charAt(i + j) != T.charAt(j)) count++;
            }
            res = Math.min(res, count);
        } int count = 0; count 0 for (int j = 0; j < T.length(); j++) {
                if (S.charAt(i + j) != T.charAt(j)) count++;
            } 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)) count++;
            } {
                if (S.charAt(i + j) != T.charAt(j)) count++;
            } if (S.charAt(i + j) != T.charAt(j)) count++; 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 count++ count res = Math.min(res, count) res Math.min(res, count) Math.min Math res count System.out.println(res) System.out.println System.out System System.out res String[] args args public class Main {
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static StringTokenizer st;

    public static void main(String[] args) throws IOException {
        String S = br.readLine();
        String T = br.readLine();

        int res = T.length();
        for (int i = 0; i <= S.length() - T.length(); i++) {
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                if (S.charAt(i + j) != T.charAt(j)) count++;
            }
            res = Math.min(res, count);
        }
        System.out.println(res);
    }
} public class Main {
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static StringTokenizer st;

    public static void main(String[] args) throws IOException {
        String S = br.readLine();
        String T = br.readLine();

        int res = T.length();
        for (int i = 0; i <= S.length() - T.length(); i++) {
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                if (S.charAt(i + j) != T.charAt(j)) count++;
            }
            res = Math.min(res, count);
        }
        System.out.println(res);
    }
} Main
import java.io.*;
import java.util.*;

public class Main {
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static StringTokenizer st;

    public static void main(String[] args) throws IOException {
        String S = br.readLine();
        String T = br.readLine();

        int res = T.length();
        for (int i = 0; i <= S.length() - T.length(); i++) {
            int count = 0;
            for (int j = 0; j < T.length(); j++) {
                if (S.charAt(i + j) != T.charAt(j)) count++;
            }
            res = Math.min(res, count);
        }
        System.out.println(res);
    }
}
