import java.util.*;

public class Main {

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

        String x = sc.next();
        String y = sc.next();

        int tmp = 0;
        int max = 0;

        for (int i = 0; i < x.length() - y.length() + 1; i++) {
            for (int j = 0; j < y.length(); j++) {
                if (x.charAt(j + i) == y.charAt(j)) {
                    tmp++;
                    if (tmp > max) {
                        max = tmp;
                    }
                }
            }
            tmp = 0;
        }

            System.out.println(y.length() - max);



        sc.close();

        }

    }
 import java.util.*; util.* java public class Main {

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

        String x = sc.next();
        String y = sc.next();

        int tmp = 0;
        int max = 0;

        for (int i = 0; i < x.length() - y.length() + 1; i++) {
            for (int j = 0; j < y.length(); j++) {
                if (x.charAt(j + i) == y.charAt(j)) {
                    tmp++;
                    if (tmp > max) {
                        max = tmp;
                    }
                }
            }
            tmp = 0;
        }

            System.out.println(y.length() - max);



        sc.close();

        }

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

        String x = sc.next();
        String y = sc.next();

        int tmp = 0;
        int max = 0;

        for (int i = 0; i < x.length() - y.length() + 1; i++) {
            for (int j = 0; j < y.length(); j++) {
                if (x.charAt(j + i) == y.charAt(j)) {
                    tmp++;
                    if (tmp > max) {
                        max = tmp;
                    }
                }
            }
            tmp = 0;
        }

            System.out.println(y.length() - max);



        sc.close();

        } main {
        Scanner sc = new Scanner(System.in);

        String x = sc.next();
        String y = sc.next();

        int tmp = 0;
        int max = 0;

        for (int i = 0; i < x.length() - y.length() + 1; i++) {
            for (int j = 0; j < y.length(); j++) {
                if (x.charAt(j + i) == y.charAt(j)) {
                    tmp++;
                    if (tmp > max) {
                        max = tmp;
                    }
                }
            }
            tmp = 0;
        }

            System.out.println(y.length() - max);



        sc.close();

        } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String x = sc.next(); x sc.next() sc.next sc String y = sc.next(); y sc.next() sc.next sc int tmp = 0; tmp 0 int max = 0; max 0 for (int i = 0; i < x.length() - y.length() + 1; i++) {
            for (int j = 0; j < y.length(); j++) {
                if (x.charAt(j + i) == y.charAt(j)) {
                    tmp++;
                    if (tmp > max) {
                        max = tmp;
                    }
                }
            }
            tmp = 0;
        } int i = 0; int i = 0; i 0 i < x.length() - y.length() + 1 i x.length() - y.length() + 1 x.length() - y.length() x.length() x.length x y.length() y.length y 1 i++ i++ i {
            for (int j = 0; j < y.length(); j++) {
                if (x.charAt(j + i) == y.charAt(j)) {
                    tmp++;
                    if (tmp > max) {
                        max = tmp;
                    }
                }
            }
            tmp = 0;
        } {
            for (int j = 0; j < y.length(); j++) {
                if (x.charAt(j + i) == y.charAt(j)) {
                    tmp++;
                    if (tmp > max) {
                        max = tmp;
                    }
                }
            }
            tmp = 0;
        } for (int j = 0; j < y.length(); j++) {
                if (x.charAt(j + i) == y.charAt(j)) {
                    tmp++;
                    if (tmp > max) {
                        max = tmp;
                    }
                }
            } int j = 0; int j = 0; j 0 j < y.length() j y.length() y.length y j++ j++ j {
                if (x.charAt(j + i) == y.charAt(j)) {
                    tmp++;
                    if (tmp > max) {
                        max = tmp;
                    }
                }
            } {
                if (x.charAt(j + i) == y.charAt(j)) {
                    tmp++;
                    if (tmp > max) {
                        max = tmp;
                    }
                }
            } if (x.charAt(j + i) == y.charAt(j)) {
                    tmp++;
                    if (tmp > max) {
                        max = tmp;
                    }
                } x.charAt(j + i) == y.charAt(j) x.charAt(j + i) x.charAt x j + i j i y.charAt(j) y.charAt y j {
                    tmp++;
                    if (tmp > max) {
                        max = tmp;
                    }
                } tmp++ tmp if (tmp > max) {
                        max = tmp;
                    } tmp > max tmp max {
                        max = tmp;
                    } max = tmp max tmp tmp = 0 tmp 0 System.out.println(y.length() - max) System.out.println System.out System System.out y.length() - max y.length() y.length y max sc.close() sc.close sc String[] args args public class Main {

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

        String x = sc.next();
        String y = sc.next();

        int tmp = 0;
        int max = 0;

        for (int i = 0; i < x.length() - y.length() + 1; i++) {
            for (int j = 0; j < y.length(); j++) {
                if (x.charAt(j + i) == y.charAt(j)) {
                    tmp++;
                    if (tmp > max) {
                        max = tmp;
                    }
                }
            }
            tmp = 0;
        }

            System.out.println(y.length() - max);



        sc.close();

        }

    } public class Main {

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

        String x = sc.next();
        String y = sc.next();

        int tmp = 0;
        int max = 0;

        for (int i = 0; i < x.length() - y.length() + 1; i++) {
            for (int j = 0; j < y.length(); j++) {
                if (x.charAt(j + i) == y.charAt(j)) {
                    tmp++;
                    if (tmp > max) {
                        max = tmp;
                    }
                }
            }
            tmp = 0;
        }

            System.out.println(y.length() - max);



        sc.close();

        }

    } Main
import java.util.*;

public class Main {

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

        String x = sc.next();
        String y = sc.next();

        int tmp = 0;
        int max = 0;

        for (int i = 0; i < x.length() - y.length() + 1; i++) {
            for (int j = 0; j < y.length(); j++) {
                if (x.charAt(j + i) == y.charAt(j)) {
                    tmp++;
                    if (tmp > max) {
                        max = tmp;
                    }
                }
            }
            tmp = 0;
        }

            System.out.println(y.length() - max);



        sc.close();

        }

    }

