import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        char[] Ts = new char[t.length()];
        for(int a = 0; a < t.length(); a++) {
            Ts[a] = t.charAt(a);
        }
        String[] Scut = new String[s.length() - t.length() + 1];
        for(int i = 0; i < s.length() - t.length() + 1; i++) {
            Scut[i] = s.substring(i, i + t.length());
        }
        int count = 0;
        int mostCount = 0;
        for(int j = 0; j < s.length() - t.length() + 1; j++) {
            for(int b = 0; b < t.length(); b++) {
                if(Scut[j].charAt(b) == Ts[b]) {
                    count++;
                }
            }
            if(mostCount <= count) {
                mostCount = count;
            }
            count = 0;
        }
        System.out.println(t.length() - mostCount);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        char[] Ts = new char[t.length()];
        for(int a = 0; a < t.length(); a++) {
            Ts[a] = t.charAt(a);
        }
        String[] Scut = new String[s.length() - t.length() + 1];
        for(int i = 0; i < s.length() - t.length() + 1; i++) {
            Scut[i] = s.substring(i, i + t.length());
        }
        int count = 0;
        int mostCount = 0;
        for(int j = 0; j < s.length() - t.length() + 1; j++) {
            for(int b = 0; b < t.length(); b++) {
                if(Scut[j].charAt(b) == Ts[b]) {
                    count++;
                }
            }
            if(mostCount <= count) {
                mostCount = count;
            }
            count = 0;
        }
        System.out.println(t.length() - mostCount);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        char[] Ts = new char[t.length()];
        for(int a = 0; a < t.length(); a++) {
            Ts[a] = t.charAt(a);
        }
        String[] Scut = new String[s.length() - t.length() + 1];
        for(int i = 0; i < s.length() - t.length() + 1; i++) {
            Scut[i] = s.substring(i, i + t.length());
        }
        int count = 0;
        int mostCount = 0;
        for(int j = 0; j < s.length() - t.length() + 1; j++) {
            for(int b = 0; b < t.length(); b++) {
                if(Scut[j].charAt(b) == Ts[b]) {
                    count++;
                }
            }
            if(mostCount <= count) {
                mostCount = count;
            }
            count = 0;
        }
        System.out.println(t.length() - mostCount);
	} main {
		Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        char[] Ts = new char[t.length()];
        for(int a = 0; a < t.length(); a++) {
            Ts[a] = t.charAt(a);
        }
        String[] Scut = new String[s.length() - t.length() + 1];
        for(int i = 0; i < s.length() - t.length() + 1; i++) {
            Scut[i] = s.substring(i, i + t.length());
        }
        int count = 0;
        int mostCount = 0;
        for(int j = 0; j < s.length() - t.length() + 1; j++) {
            for(int b = 0; b < t.length(); b++) {
                if(Scut[j].charAt(b) == Ts[b]) {
                    count++;
                }
            }
            if(mostCount <= count) {
                mostCount = count;
            }
            count = 0;
        }
        System.out.println(t.length() - mostCount);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc char[] Ts = new char[t.length()]; Ts new char[t.length()] t.length() t.length t for(int a = 0; a < t.length(); a++) {
            Ts[a] = t.charAt(a);
        } int a = 0; int a = 0; a 0 a < t.length() a t.length() t.length t a++ a++ a {
            Ts[a] = t.charAt(a);
        } {
            Ts[a] = t.charAt(a);
        } Ts[a] = t.charAt(a) Ts[a] Ts a t.charAt(a) t.charAt t a String[] Scut = new String[s.length() - t.length() + 1]; Scut new String[s.length() - t.length() + 1] s.length() - t.length() + 1 s.length() - t.length() s.length() s.length s t.length() t.length t 1 for(int i = 0; i < s.length() - t.length() + 1; i++) {
            Scut[i] = s.substring(i, i + t.length());
        } int i = 0; int i = 0; i 0 i < s.length() - t.length() + 1 i s.length() - t.length() + 1 s.length() - t.length() s.length() s.length s t.length() t.length t 1 i++ i++ i {
            Scut[i] = s.substring(i, i + t.length());
        } {
            Scut[i] = s.substring(i, i + t.length());
        } Scut[i] = s.substring(i, i + t.length()) Scut[i] Scut i s.substring(i, i + t.length()) s.substring s i i + t.length() i t.length() t.length t int count = 0; count 0 int mostCount = 0; mostCount 0 for(int j = 0; j < s.length() - t.length() + 1; j++) {
            for(int b = 0; b < t.length(); b++) {
                if(Scut[j].charAt(b) == Ts[b]) {
                    count++;
                }
            }
            if(mostCount <= count) {
                mostCount = count;
            }
            count = 0;
        } int j = 0; int j = 0; j 0 j < s.length() - t.length() + 1 j s.length() - t.length() + 1 s.length() - t.length() s.length() s.length s t.length() t.length t 1 j++ j++ j {
            for(int b = 0; b < t.length(); b++) {
                if(Scut[j].charAt(b) == Ts[b]) {
                    count++;
                }
            }
            if(mostCount <= count) {
                mostCount = count;
            }
            count = 0;
        } {
            for(int b = 0; b < t.length(); b++) {
                if(Scut[j].charAt(b) == Ts[b]) {
                    count++;
                }
            }
            if(mostCount <= count) {
                mostCount = count;
            }
            count = 0;
        } for(int b = 0; b < t.length(); b++) {
                if(Scut[j].charAt(b) == Ts[b]) {
                    count++;
                }
            } int b = 0; int b = 0; b 0 b < t.length() b t.length() t.length t b++ b++ b {
                if(Scut[j].charAt(b) == Ts[b]) {
                    count++;
                }
            } {
                if(Scut[j].charAt(b) == Ts[b]) {
                    count++;
                }
            } if(Scut[j].charAt(b) == Ts[b]) {
                    count++;
                } Scut[j].charAt(b) == Ts[b] Scut[j].charAt(b) Scut[j].charAt Scut[j] Scut j b Ts[b] Ts b {
                    count++;
                } count++ count if(mostCount <= count) {
                mostCount = count;
            } mostCount <= count mostCount count {
                mostCount = count;
            } mostCount = count mostCount count count = 0 count 0 System.out.println(t.length() - mostCount) System.out.println System.out System System.out t.length() - mostCount t.length() t.length t mostCount String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        char[] Ts = new char[t.length()];
        for(int a = 0; a < t.length(); a++) {
            Ts[a] = t.charAt(a);
        }
        String[] Scut = new String[s.length() - t.length() + 1];
        for(int i = 0; i < s.length() - t.length() + 1; i++) {
            Scut[i] = s.substring(i, i + t.length());
        }
        int count = 0;
        int mostCount = 0;
        for(int j = 0; j < s.length() - t.length() + 1; j++) {
            for(int b = 0; b < t.length(); b++) {
                if(Scut[j].charAt(b) == Ts[b]) {
                    count++;
                }
            }
            if(mostCount <= count) {
                mostCount = count;
            }
            count = 0;
        }
        System.out.println(t.length() - mostCount);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        char[] Ts = new char[t.length()];
        for(int a = 0; a < t.length(); a++) {
            Ts[a] = t.charAt(a);
        }
        String[] Scut = new String[s.length() - t.length() + 1];
        for(int i = 0; i < s.length() - t.length() + 1; i++) {
            Scut[i] = s.substring(i, i + t.length());
        }
        int count = 0;
        int mostCount = 0;
        for(int j = 0; j < s.length() - t.length() + 1; j++) {
            for(int b = 0; b < t.length(); b++) {
                if(Scut[j].charAt(b) == Ts[b]) {
                    count++;
                }
            }
            if(mostCount <= count) {
                mostCount = count;
            }
            count = 0;
        }
        System.out.println(t.length() - mostCount);
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        char[] Ts = new char[t.length()];
        for(int a = 0; a < t.length(); a++) {
            Ts[a] = t.charAt(a);
        }
        String[] Scut = new String[s.length() - t.length() + 1];
        for(int i = 0; i < s.length() - t.length() + 1; i++) {
            Scut[i] = s.substring(i, i + t.length());
        }
        int count = 0;
        int mostCount = 0;
        for(int j = 0; j < s.length() - t.length() + 1; j++) {
            for(int b = 0; b < t.length(); b++) {
                if(Scut[j].charAt(b) == Ts[b]) {
                    count++;
                }
            }
            if(mostCount <= count) {
                mostCount = count;
            }
            count = 0;
        }
        System.out.println(t.length() - mostCount);
	}
}