import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next(), t = sc.next();
        long min_different = Long.MAX_VALUE;
        for (int i = 0; i < s.length(); i++) {
            long diff = 0;
            if (i + t.length() > s.length())
                break;
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j))
                    diff++;
            }
            min_different = Math.min(min_different, diff);
        }

        sc.close();
        System.out.println(min_different);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next(), t = sc.next();
        long min_different = Long.MAX_VALUE;
        for (int i = 0; i < s.length(); i++) {
            long diff = 0;
            if (i + t.length() > s.length())
                break;
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j))
                    diff++;
            }
            min_different = Math.min(min_different, diff);
        }

        sc.close();
        System.out.println(min_different);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next(), t = sc.next();
        long min_different = Long.MAX_VALUE;
        for (int i = 0; i < s.length(); i++) {
            long diff = 0;
            if (i + t.length() > s.length())
                break;
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j))
                    diff++;
            }
            min_different = Math.min(min_different, diff);
        }

        sc.close();
        System.out.println(min_different);
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next(), t = sc.next();
        long min_different = Long.MAX_VALUE;
        for (int i = 0; i < s.length(); i++) {
            long diff = 0;
            if (i + t.length() > s.length())
                break;
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j))
                    diff++;
            }
            min_different = Math.min(min_different, diff);
        }

        sc.close();
        System.out.println(min_different);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next() s sc.next() sc.next sc t = sc.next(); t sc.next() sc.next sc long min_different = Long.MAX_VALUE; min_different Long.MAX_VALUE Long Long.MAX_VALUE for (int i = 0; i < s.length(); i++) {
            long diff = 0;
            if (i + t.length() > s.length())
                break;
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j))
                    diff++;
            }
            min_different = Math.min(min_different, diff);
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            long diff = 0;
            if (i + t.length() > s.length())
                break;
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j))
                    diff++;
            }
            min_different = Math.min(min_different, diff);
        } {
            long diff = 0;
            if (i + t.length() > s.length())
                break;
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j))
                    diff++;
            }
            min_different = Math.min(min_different, diff);
        } long diff = 0; diff 0 if (i + t.length() > s.length())
                break; i + t.length() > s.length() i + t.length() i t.length() t.length t s.length() s.length s break; for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j))
                    diff++;
            } 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))
                    diff++;
            } {
                if (s.charAt(i + j) != t.charAt(j))
                    diff++;
            } if (s.charAt(i + j) != t.charAt(j))
                    diff++; 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 diff++ diff min_different = Math.min(min_different, diff) min_different Math.min(min_different, diff) Math.min Math min_different diff sc.close() sc.close sc System.out.println(min_different) System.out.println System.out System System.out min_different String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next(), t = sc.next();
        long min_different = Long.MAX_VALUE;
        for (int i = 0; i < s.length(); i++) {
            long diff = 0;
            if (i + t.length() > s.length())
                break;
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j))
                    diff++;
            }
            min_different = Math.min(min_different, diff);
        }

        sc.close();
        System.out.println(min_different);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next(), t = sc.next();
        long min_different = Long.MAX_VALUE;
        for (int i = 0; i < s.length(); i++) {
            long diff = 0;
            if (i + t.length() > s.length())
                break;
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j))
                    diff++;
            }
            min_different = Math.min(min_different, diff);
        }

        sc.close();
        System.out.println(min_different);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next(), t = sc.next();
        long min_different = Long.MAX_VALUE;
        for (int i = 0; i < s.length(); i++) {
            long diff = 0;
            if (i + t.length() > s.length())
                break;
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i + j) != t.charAt(j))
                    diff++;
            }
            min_different = Math.min(min_different, diff);
        }

        sc.close();
        System.out.println(min_different);
    }
}
