import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;


public class Main {

    static int res(String ss, String t) {
        int cnt = 0;
        for(int i=0;i<ss.length();i++) {
            if(ss.charAt(i) != t.charAt(i)) {
                cnt++;
            }
        }
        return cnt;
    }


    static void solve() {
        Scanner scan = new Scanner(System.in);

        String s = scan.next();
        String t = scan.next();
        int min = t.length();
        for(int i = 0; i + t.length() <= s.length(); i++) {
            String ss = s.substring(i, i+t.length());
            int cnt = res(ss, t);
            min = Math.min(cnt, min);
        }
        System.out.println(min);

//        int t = scan.nextInt();
//        for (int i = 0; i < t; i++) {
////            solveCase();
//        }


//        long t = scan.nextLong();

//        for (int i = 0; i < t; i++) {
//            int n = scan.nextInt();
////            scase(n);
//        }
    }


    static void solveCase(int zero1, int one1, int two1, int zero2, int one2, int two2) {

    }

    static void scase(int[] arr1, int[] arr2) {
    }


    public static void main(String[] args) {

        solve();
    }


    static class LoggerNode {
        String message;
        int ts;
    }


    static class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode(int x) {
            val = x;
        }
    }

    static class ListNode {
        int val;
        ListNode next;

        ListNode() {
        }

        ListNode(int val) {
            this.val = val;
        }

        ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    }
} import java.util.Arrays; Arrays java.util import java.util.Comparator; Comparator java.util import java.util.Scanner; Scanner java.util public class Main {

    static int res(String ss, String t) {
        int cnt = 0;
        for(int i=0;i<ss.length();i++) {
            if(ss.charAt(i) != t.charAt(i)) {
                cnt++;
            }
        }
        return cnt;
    }


    static void solve() {
        Scanner scan = new Scanner(System.in);

        String s = scan.next();
        String t = scan.next();
        int min = t.length();
        for(int i = 0; i + t.length() <= s.length(); i++) {
            String ss = s.substring(i, i+t.length());
            int cnt = res(ss, t);
            min = Math.min(cnt, min);
        }
        System.out.println(min);

//        int t = scan.nextInt();
//        for (int i = 0; i < t; i++) {
////            solveCase();
//        }


//        long t = scan.nextLong();

//        for (int i = 0; i < t; i++) {
//            int n = scan.nextInt();
////            scase(n);
//        }
    }


    static void solveCase(int zero1, int one1, int two1, int zero2, int one2, int two2) {

    }

    static void scase(int[] arr1, int[] arr2) {
    }


    public static void main(String[] args) {

        solve();
    }


    static class LoggerNode {
        String message;
        int ts;
    }


    static class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode(int x) {
            val = x;
        }
    }

    static class ListNode {
        int val;
        ListNode next;

        ListNode() {
        }

        ListNode(int val) {
            this.val = val;
        }

        ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    }
} Main static int res(String ss, String t) {
        int cnt = 0;
        for(int i=0;i<ss.length();i++) {
            if(ss.charAt(i) != t.charAt(i)) {
                cnt++;
            }
        }
        return cnt;
    } res {
        int cnt = 0;
        for(int i=0;i<ss.length();i++) {
            if(ss.charAt(i) != t.charAt(i)) {
                cnt++;
            }
        }
        return cnt;
    } int cnt = 0; cnt 0 for(int i=0;i<ss.length();i++) {
            if(ss.charAt(i) != t.charAt(i)) {
                cnt++;
            }
        } int i=0; int i=0; i 0 i<ss.length() i ss.length() ss.length ss i++ i++ i {
            if(ss.charAt(i) != t.charAt(i)) {
                cnt++;
            }
        } {
            if(ss.charAt(i) != t.charAt(i)) {
                cnt++;
            }
        } if(ss.charAt(i) != t.charAt(i)) {
                cnt++;
            } ss.charAt(i) != t.charAt(i) ss.charAt(i) ss.charAt ss i t.charAt(i) t.charAt t i {
                cnt++;
            } cnt++ cnt return cnt; cnt String ss ss String t t static void solve() {
        Scanner scan = new Scanner(System.in);

        String s = scan.next();
        String t = scan.next();
        int min = t.length();
        for(int i = 0; i + t.length() <= s.length(); i++) {
            String ss = s.substring(i, i+t.length());
            int cnt = res(ss, t);
            min = Math.min(cnt, min);
        }
        System.out.println(min);

//        int t = scan.nextInt();
//        for (int i = 0; i < t; i++) {
////            solveCase();
//        }


//        long t = scan.nextLong();

//        for (int i = 0; i < t; i++) {
//            int n = scan.nextInt();
////            scase(n);
//        }
    } solve {
        Scanner scan = new Scanner(System.in);

        String s = scan.next();
        String t = scan.next();
        int min = t.length();
        for(int i = 0; i + t.length() <= s.length(); i++) {
            String ss = s.substring(i, i+t.length());
            int cnt = res(ss, t);
            min = Math.min(cnt, min);
        }
        System.out.println(min);

//        int t = scan.nextInt();
//        for (int i = 0; i < t; i++) {
////            solveCase();
//        }


//        long t = scan.nextLong();

//        for (int i = 0; i < t; i++) {
//            int n = scan.nextInt();
////            scase(n);
//        }
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan String t = scan.next(); t scan.next() scan.next scan int min = t.length(); min t.length() t.length t for(int i = 0; i + t.length() <= s.length(); i++) {
            String ss = s.substring(i, i+t.length());
            int cnt = res(ss, t);
            min = Math.min(cnt, min);
        } int i = 0; int i = 0; i 0 i + t.length() <= s.length() i + t.length() i t.length() t.length t s.length() s.length s i++ i++ i {
            String ss = s.substring(i, i+t.length());
            int cnt = res(ss, t);
            min = Math.min(cnt, min);
        } {
            String ss = s.substring(i, i+t.length());
            int cnt = res(ss, t);
            min = Math.min(cnt, min);
        } String ss = s.substring(i, i+t.length()); ss s.substring(i, i+t.length()) s.substring s i i+t.length() i t.length() t.length t int cnt = res(ss, t); cnt res(ss, t) res ss t min = Math.min(cnt, min) min Math.min(cnt, min) Math.min Math cnt min System.out.println(min) System.out.println System.out System System.out min static void solveCase(int zero1, int one1, int two1, int zero2, int one2, int two2) {

    } solveCase {

    } int zero1 zero1 int one1 one1 int two1 two1 int zero2 zero2 int one2 one2 int two2 two2 static void scase(int[] arr1, int[] arr2) {
    } scase {
    } int[] arr1 arr1 int[] arr2 arr2 public static void main(String[] args) {

        solve();
    } main {

        solve();
    } solve() solve String[] args args static class LoggerNode {
        String message;
        int ts;
    } LoggerNode String message; message int ts; ts static class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode(int x) {
            val = x;
        }
    } TreeNode int val; val TreeNode left; left TreeNode right; right TreeNode(int x) {
            val = x;
        } TreeNode {
            val = x;
        } val = x val x int x x static class ListNode {
        int val;
        ListNode next;

        ListNode() {
        }

        ListNode(int val) {
            this.val = val;
        }

        ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    } ListNode int val; val ListNode next; next ListNode() {
        } ListNode {
        } ListNode(int val) {
            this.val = val;
        } ListNode {
            this.val = val;
        } this.val = val this.val this this.val val int val val ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        } ListNode {
            this.val = val;
            this.next = next;
        } this.val = val this.val this this.val val this.next = next this.next this this.next next int val val ListNode next next public class Main {

    static int res(String ss, String t) {
        int cnt = 0;
        for(int i=0;i<ss.length();i++) {
            if(ss.charAt(i) != t.charAt(i)) {
                cnt++;
            }
        }
        return cnt;
    }


    static void solve() {
        Scanner scan = new Scanner(System.in);

        String s = scan.next();
        String t = scan.next();
        int min = t.length();
        for(int i = 0; i + t.length() <= s.length(); i++) {
            String ss = s.substring(i, i+t.length());
            int cnt = res(ss, t);
            min = Math.min(cnt, min);
        }
        System.out.println(min);

//        int t = scan.nextInt();
//        for (int i = 0; i < t; i++) {
////            solveCase();
//        }


//        long t = scan.nextLong();

//        for (int i = 0; i < t; i++) {
//            int n = scan.nextInt();
////            scase(n);
//        }
    }


    static void solveCase(int zero1, int one1, int two1, int zero2, int one2, int two2) {

    }

    static void scase(int[] arr1, int[] arr2) {
    }


    public static void main(String[] args) {

        solve();
    }


    static class LoggerNode {
        String message;
        int ts;
    }


    static class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode(int x) {
            val = x;
        }
    }

    static class ListNode {
        int val;
        ListNode next;

        ListNode() {
        }

        ListNode(int val) {
            this.val = val;
        }

        ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    }
} public class Main {

    static int res(String ss, String t) {
        int cnt = 0;
        for(int i=0;i<ss.length();i++) {
            if(ss.charAt(i) != t.charAt(i)) {
                cnt++;
            }
        }
        return cnt;
    }


    static void solve() {
        Scanner scan = new Scanner(System.in);

        String s = scan.next();
        String t = scan.next();
        int min = t.length();
        for(int i = 0; i + t.length() <= s.length(); i++) {
            String ss = s.substring(i, i+t.length());
            int cnt = res(ss, t);
            min = Math.min(cnt, min);
        }
        System.out.println(min);

//        int t = scan.nextInt();
//        for (int i = 0; i < t; i++) {
////            solveCase();
//        }


//        long t = scan.nextLong();

//        for (int i = 0; i < t; i++) {
//            int n = scan.nextInt();
////            scase(n);
//        }
    }


    static void solveCase(int zero1, int one1, int two1, int zero2, int one2, int two2) {

    }

    static void scase(int[] arr1, int[] arr2) {
    }


    public static void main(String[] args) {

        solve();
    }


    static class LoggerNode {
        String message;
        int ts;
    }


    static class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode(int x) {
            val = x;
        }
    }

    static class ListNode {
        int val;
        ListNode next;

        ListNode() {
        }

        ListNode(int val) {
            this.val = val;
        }

        ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    }
} Main
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;


public class Main {

    static int res(String ss, String t) {
        int cnt = 0;
        for(int i=0;i<ss.length();i++) {
            if(ss.charAt(i) != t.charAt(i)) {
                cnt++;
            }
        }
        return cnt;
    }


    static void solve() {
        Scanner scan = new Scanner(System.in);

        String s = scan.next();
        String t = scan.next();
        int min = t.length();
        for(int i = 0; i + t.length() <= s.length(); i++) {
            String ss = s.substring(i, i+t.length());
            int cnt = res(ss, t);
            min = Math.min(cnt, min);
        }
        System.out.println(min);

//        int t = scan.nextInt();
//        for (int i = 0; i < t; i++) {
////            solveCase();
//        }


//        long t = scan.nextLong();

//        for (int i = 0; i < t; i++) {
//            int n = scan.nextInt();
////            scase(n);
//        }
    }


    static void solveCase(int zero1, int one1, int two1, int zero2, int one2, int two2) {

    }

    static void scase(int[] arr1, int[] arr2) {
    }


    public static void main(String[] args) {

        solve();
    }


    static class LoggerNode {
        String message;
        int ts;
    }


    static class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode(int x) {
            val = x;
        }
    }

    static class ListNode {
        int val;
        ListNode next;

        ListNode() {
        }

        ListNode(int val) {
            this.val = val;
        }

        ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    }
}