import java.util.ArrayList;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();

        ArrayList<String> aL = new ArrayList<>();

        for (int i = 0; i <= s.length() - t.length(); i++) {
            aL.add(s.substring(i, i + t.length()));
        }

        int ir = 0;

        for (String a : aL) {
            int c = 0;
            for (int i = 0; i < t.length(); i++) {
                if (a.charAt(i) == t.charAt(i)) {
                    c += 1;
                    if (ir > c) {
                      continue;
                    }
                }
                if (ir < c) {
                  ir = c;
                }
            }
        }

        System.out.println(t.length() - ir);
    }
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();

        ArrayList<String> aL = new ArrayList<>();

        for (int i = 0; i <= s.length() - t.length(); i++) {
            aL.add(s.substring(i, i + t.length()));
        }

        int ir = 0;

        for (String a : aL) {
            int c = 0;
            for (int i = 0; i < t.length(); i++) {
                if (a.charAt(i) == t.charAt(i)) {
                    c += 1;
                    if (ir > c) {
                      continue;
                    }
                }
                if (ir < c) {
                  ir = c;
                }
            }
        }

        System.out.println(t.length() - ir);
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();

        ArrayList<String> aL = new ArrayList<>();

        for (int i = 0; i <= s.length() - t.length(); i++) {
            aL.add(s.substring(i, i + t.length()));
        }

        int ir = 0;

        for (String a : aL) {
            int c = 0;
            for (int i = 0; i < t.length(); i++) {
                if (a.charAt(i) == t.charAt(i)) {
                    c += 1;
                    if (ir > c) {
                      continue;
                    }
                }
                if (ir < c) {
                  ir = c;
                }
            }
        }

        System.out.println(t.length() - ir);
    } main {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();

        ArrayList<String> aL = new ArrayList<>();

        for (int i = 0; i <= s.length() - t.length(); i++) {
            aL.add(s.substring(i, i + t.length()));
        }

        int ir = 0;

        for (String a : aL) {
            int c = 0;
            for (int i = 0; i < t.length(); i++) {
                if (a.charAt(i) == t.charAt(i)) {
                    c += 1;
                    if (ir > c) {
                      continue;
                    }
                }
                if (ir < c) {
                  ir = c;
                }
            }
        }

        System.out.println(t.length() - ir);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String s = scanner.next(); s scanner.next() scanner.next scanner String t = scanner.next(); t scanner.next() scanner.next scanner ArrayList<String> aL = new ArrayList<>(); aL new ArrayList<>() for (int i = 0; i <= s.length() - t.length(); i++) {
            aL.add(s.substring(i, i + t.length()));
        } 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 {
            aL.add(s.substring(i, i + t.length()));
        } {
            aL.add(s.substring(i, i + t.length()));
        } aL.add(s.substring(i, i + t.length())) aL.add aL s.substring(i, i + t.length()) s.substring s i i + t.length() i t.length() t.length t int ir = 0; ir 0 for (String a : aL) {
            int c = 0;
            for (int i = 0; i < t.length(); i++) {
                if (a.charAt(i) == t.charAt(i)) {
                    c += 1;
                    if (ir > c) {
                      continue;
                    }
                }
                if (ir < c) {
                  ir = c;
                }
            }
        } String a aL {
            int c = 0;
            for (int i = 0; i < t.length(); i++) {
                if (a.charAt(i) == t.charAt(i)) {
                    c += 1;
                    if (ir > c) {
                      continue;
                    }
                }
                if (ir < c) {
                  ir = c;
                }
            }
        } {
            int c = 0;
            for (int i = 0; i < t.length(); i++) {
                if (a.charAt(i) == t.charAt(i)) {
                    c += 1;
                    if (ir > c) {
                      continue;
                    }
                }
                if (ir < c) {
                  ir = c;
                }
            }
        } int c = 0; c 0 for (int i = 0; i < t.length(); i++) {
                if (a.charAt(i) == t.charAt(i)) {
                    c += 1;
                    if (ir > c) {
                      continue;
                    }
                }
                if (ir < c) {
                  ir = c;
                }
            } int i = 0; int i = 0; i 0 i < t.length() i t.length() t.length t i++ i++ i {
                if (a.charAt(i) == t.charAt(i)) {
                    c += 1;
                    if (ir > c) {
                      continue;
                    }
                }
                if (ir < c) {
                  ir = c;
                }
            } {
                if (a.charAt(i) == t.charAt(i)) {
                    c += 1;
                    if (ir > c) {
                      continue;
                    }
                }
                if (ir < c) {
                  ir = c;
                }
            } if (a.charAt(i) == t.charAt(i)) {
                    c += 1;
                    if (ir > c) {
                      continue;
                    }
                } a.charAt(i) == t.charAt(i) a.charAt(i) a.charAt a i t.charAt(i) t.charAt t i {
                    c += 1;
                    if (ir > c) {
                      continue;
                    }
                } c += 1 c 1 if (ir > c) {
                      continue;
                    } ir > c ir c {
                      continue;
                    } continue; if (ir < c) {
                  ir = c;
                } ir < c ir c {
                  ir = c;
                } ir = c ir c System.out.println(t.length() - ir) System.out.println System.out System System.out t.length() - ir t.length() t.length t ir String[] args args public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();

        ArrayList<String> aL = new ArrayList<>();

        for (int i = 0; i <= s.length() - t.length(); i++) {
            aL.add(s.substring(i, i + t.length()));
        }

        int ir = 0;

        for (String a : aL) {
            int c = 0;
            for (int i = 0; i < t.length(); i++) {
                if (a.charAt(i) == t.charAt(i)) {
                    c += 1;
                    if (ir > c) {
                      continue;
                    }
                }
                if (ir < c) {
                  ir = c;
                }
            }
        }

        System.out.println(t.length() - ir);
    }
} public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();

        ArrayList<String> aL = new ArrayList<>();

        for (int i = 0; i <= s.length() - t.length(); i++) {
            aL.add(s.substring(i, i + t.length()));
        }

        int ir = 0;

        for (String a : aL) {
            int c = 0;
            for (int i = 0; i < t.length(); i++) {
                if (a.charAt(i) == t.charAt(i)) {
                    c += 1;
                    if (ir > c) {
                      continue;
                    }
                }
                if (ir < c) {
                  ir = c;
                }
            }
        }

        System.out.println(t.length() - ir);
    }
} Main
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();

        ArrayList<String> aL = new ArrayList<>();

        for (int i = 0; i <= s.length() - t.length(); i++) {
            aL.add(s.substring(i, i + t.length()));
        }

        int ir = 0;

        for (String a : aL) {
            int c = 0;
            for (int i = 0; i < t.length(); i++) {
                if (a.charAt(i) == t.charAt(i)) {
                    c += 1;
                    if (ir > c) {
                      continue;
                    }
                }
                if (ir < c) {
                  ir = c;
                }
            }
        }

        System.out.println(t.length() - ir);
    }
}
