import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String S = s.next();
        String T = s.next();
        char[] SS = S.toCharArray();
        char[] TT = T.toCharArray();
        int count = T.length();

        for (int i = 0; i < T.length(); i++) {
            for (int j = i; j < S.length(); j++) {
                int n = i;
                if (TT[i] == SS[j]) {
                    for (int k = 0; k < T.length() - i; k++) {
                        if(j + k >= S.length()){
                            n = count;
                            break;
                        }
                        if (TT[i + k] != SS[j + k]) n++;
                    }
                    if (n < count) count = n;
                }
            }
        }

        System.out.println(count);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String S = s.next();
        String T = s.next();
        char[] SS = S.toCharArray();
        char[] TT = T.toCharArray();
        int count = T.length();

        for (int i = 0; i < T.length(); i++) {
            for (int j = i; j < S.length(); j++) {
                int n = i;
                if (TT[i] == SS[j]) {
                    for (int k = 0; k < T.length() - i; k++) {
                        if(j + k >= S.length()){
                            n = count;
                            break;
                        }
                        if (TT[i + k] != SS[j + k]) n++;
                    }
                    if (n < count) count = n;
                }
            }
        }

        System.out.println(count);
    }
} Main public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String S = s.next();
        String T = s.next();
        char[] SS = S.toCharArray();
        char[] TT = T.toCharArray();
        int count = T.length();

        for (int i = 0; i < T.length(); i++) {
            for (int j = i; j < S.length(); j++) {
                int n = i;
                if (TT[i] == SS[j]) {
                    for (int k = 0; k < T.length() - i; k++) {
                        if(j + k >= S.length()){
                            n = count;
                            break;
                        }
                        if (TT[i + k] != SS[j + k]) n++;
                    }
                    if (n < count) count = n;
                }
            }
        }

        System.out.println(count);
    } main {
        Scanner s = new Scanner(System.in);
        String S = s.next();
        String T = s.next();
        char[] SS = S.toCharArray();
        char[] TT = T.toCharArray();
        int count = T.length();

        for (int i = 0; i < T.length(); i++) {
            for (int j = i; j < S.length(); j++) {
                int n = i;
                if (TT[i] == SS[j]) {
                    for (int k = 0; k < T.length() - i; k++) {
                        if(j + k >= S.length()){
                            n = count;
                            break;
                        }
                        if (TT[i + k] != SS[j + k]) n++;
                    }
                    if (n < count) count = n;
                }
            }
        }

        System.out.println(count);
    } Scanner s = new Scanner(System.in); s new Scanner(System.in) String S = s.next(); S s.next() s.next s String T = s.next(); T s.next() s.next s char[] SS = S.toCharArray(); SS S.toCharArray() S.toCharArray S char[] TT = T.toCharArray(); TT T.toCharArray() T.toCharArray T int count = T.length(); count T.length() T.length T for (int i = 0; i < T.length(); i++) {
            for (int j = i; j < S.length(); j++) {
                int n = i;
                if (TT[i] == SS[j]) {
                    for (int k = 0; k < T.length() - i; k++) {
                        if(j + k >= S.length()){
                            n = count;
                            break;
                        }
                        if (TT[i + k] != SS[j + k]) n++;
                    }
                    if (n < count) count = n;
                }
            }
        } int i = 0; int i = 0; i 0 i < T.length() i T.length() T.length T i++ i++ i {
            for (int j = i; j < S.length(); j++) {
                int n = i;
                if (TT[i] == SS[j]) {
                    for (int k = 0; k < T.length() - i; k++) {
                        if(j + k >= S.length()){
                            n = count;
                            break;
                        }
                        if (TT[i + k] != SS[j + k]) n++;
                    }
                    if (n < count) count = n;
                }
            }
        } {
            for (int j = i; j < S.length(); j++) {
                int n = i;
                if (TT[i] == SS[j]) {
                    for (int k = 0; k < T.length() - i; k++) {
                        if(j + k >= S.length()){
                            n = count;
                            break;
                        }
                        if (TT[i + k] != SS[j + k]) n++;
                    }
                    if (n < count) count = n;
                }
            }
        } for (int j = i; j < S.length(); j++) {
                int n = i;
                if (TT[i] == SS[j]) {
                    for (int k = 0; k < T.length() - i; k++) {
                        if(j + k >= S.length()){
                            n = count;
                            break;
                        }
                        if (TT[i + k] != SS[j + k]) n++;
                    }
                    if (n < count) count = n;
                }
            } int j = i; int j = i; j i j < S.length() j S.length() S.length S j++ j++ j {
                int n = i;
                if (TT[i] == SS[j]) {
                    for (int k = 0; k < T.length() - i; k++) {
                        if(j + k >= S.length()){
                            n = count;
                            break;
                        }
                        if (TT[i + k] != SS[j + k]) n++;
                    }
                    if (n < count) count = n;
                }
            } {
                int n = i;
                if (TT[i] == SS[j]) {
                    for (int k = 0; k < T.length() - i; k++) {
                        if(j + k >= S.length()){
                            n = count;
                            break;
                        }
                        if (TT[i + k] != SS[j + k]) n++;
                    }
                    if (n < count) count = n;
                }
            } int n = i; n i if (TT[i] == SS[j]) {
                    for (int k = 0; k < T.length() - i; k++) {
                        if(j + k >= S.length()){
                            n = count;
                            break;
                        }
                        if (TT[i + k] != SS[j + k]) n++;
                    }
                    if (n < count) count = n;
                } TT[i] == SS[j] TT[i] TT i SS[j] SS j {
                    for (int k = 0; k < T.length() - i; k++) {
                        if(j + k >= S.length()){
                            n = count;
                            break;
                        }
                        if (TT[i + k] != SS[j + k]) n++;
                    }
                    if (n < count) count = n;
                } for (int k = 0; k < T.length() - i; k++) {
                        if(j + k >= S.length()){
                            n = count;
                            break;
                        }
                        if (TT[i + k] != SS[j + k]) n++;
                    } int k = 0; int k = 0; k 0 k < T.length() - i k T.length() - i T.length() T.length T i k++ k++ k {
                        if(j + k >= S.length()){
                            n = count;
                            break;
                        }
                        if (TT[i + k] != SS[j + k]) n++;
                    } {
                        if(j + k >= S.length()){
                            n = count;
                            break;
                        }
                        if (TT[i + k] != SS[j + k]) n++;
                    } if(j + k >= S.length()){
                            n = count;
                            break;
                        } j + k >= S.length() j + k j k S.length() S.length S {
                            n = count;
                            break;
                        } n = count n count break; if (TT[i + k] != SS[j + k]) n++; TT[i + k] != SS[j + k] TT[i + k] TT i + k i k SS[j + k] SS j + k j k n++ n if (n < count) count = n; n < count n count count = n count n System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String S = s.next();
        String T = s.next();
        char[] SS = S.toCharArray();
        char[] TT = T.toCharArray();
        int count = T.length();

        for (int i = 0; i < T.length(); i++) {
            for (int j = i; j < S.length(); j++) {
                int n = i;
                if (TT[i] == SS[j]) {
                    for (int k = 0; k < T.length() - i; k++) {
                        if(j + k >= S.length()){
                            n = count;
                            break;
                        }
                        if (TT[i + k] != SS[j + k]) n++;
                    }
                    if (n < count) count = n;
                }
            }
        }

        System.out.println(count);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String S = s.next();
        String T = s.next();
        char[] SS = S.toCharArray();
        char[] TT = T.toCharArray();
        int count = T.length();

        for (int i = 0; i < T.length(); i++) {
            for (int j = i; j < S.length(); j++) {
                int n = i;
                if (TT[i] == SS[j]) {
                    for (int k = 0; k < T.length() - i; k++) {
                        if(j + k >= S.length()){
                            n = count;
                            break;
                        }
                        if (TT[i + k] != SS[j + k]) n++;
                    }
                    if (n < count) count = n;
                }
            }
        }

        System.out.println(count);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String S = s.next();
        String T = s.next();
        char[] SS = S.toCharArray();
        char[] TT = T.toCharArray();
        int count = T.length();

        for (int i = 0; i < T.length(); i++) {
            for (int j = i; j < S.length(); j++) {
                int n = i;
                if (TT[i] == SS[j]) {
                    for (int k = 0; k < T.length() - i; k++) {
                        if(j + k >= S.length()){
                            n = count;
                            break;
                        }
                        if (TT[i + k] != SS[j + k]) n++;
                    }
                    if (n < count) count = n;
                }
            }
        }

        System.out.println(count);
    }
}