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[] chS = s.toCharArray();
        char[] chT = t.toCharArray();
        int min = t.length(); 
        for (int i = 0; i <= s.length() - t.length(); i++) {
            int cur = 0; 
            for (int j = 0; j < t.length(); j++) {
                    if (chS[i + j] != chT[j]) {
                        cur++;
                    } 
            }
            min = Math.min(min, cur);
        }
        System.out.println(min);
	}
} 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[] chS = s.toCharArray();
        char[] chT = t.toCharArray();
        int min = t.length(); 
        for (int i = 0; i <= s.length() - t.length(); i++) {
            int cur = 0; 
            for (int j = 0; j < t.length(); j++) {
                    if (chS[i + j] != chT[j]) {
                        cur++;
                    } 
            }
            min = Math.min(min, cur);
        }
        System.out.println(min);
	}
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        char[] chS = s.toCharArray();
        char[] chT = t.toCharArray();
        int min = t.length(); 
        for (int i = 0; i <= s.length() - t.length(); i++) {
            int cur = 0; 
            for (int j = 0; j < t.length(); j++) {
                    if (chS[i + j] != chT[j]) {
                        cur++;
                    } 
            }
            min = Math.min(min, cur);
        }
        System.out.println(min);
	} main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        char[] chS = s.toCharArray();
        char[] chT = t.toCharArray();
        int min = t.length(); 
        for (int i = 0; i <= s.length() - t.length(); i++) {
            int cur = 0; 
            for (int j = 0; j < t.length(); j++) {
                    if (chS[i + j] != chT[j]) {
                        cur++;
                    } 
            }
            min = Math.min(min, cur);
        }
        System.out.println(min);
	} 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[] chS = s.toCharArray(); chS s.toCharArray() s.toCharArray s char[] chT = t.toCharArray(); chT t.toCharArray() t.toCharArray t int min = t.length(); min t.length() t.length t for (int i = 0; i <= s.length() - t.length(); i++) {
            int cur = 0; 
            for (int j = 0; j < t.length(); j++) {
                    if (chS[i + j] != chT[j]) {
                        cur++;
                    } 
            }
            min = Math.min(min, cur);
        } 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 {
            int cur = 0; 
            for (int j = 0; j < t.length(); j++) {
                    if (chS[i + j] != chT[j]) {
                        cur++;
                    } 
            }
            min = Math.min(min, cur);
        } {
            int cur = 0; 
            for (int j = 0; j < t.length(); j++) {
                    if (chS[i + j] != chT[j]) {
                        cur++;
                    } 
            }
            min = Math.min(min, cur);
        } int cur = 0; cur 0 for (int j = 0; j < t.length(); j++) {
                    if (chS[i + j] != chT[j]) {
                        cur++;
                    } 
            } int j = 0; int j = 0; j 0 j < t.length() j t.length() t.length t j++ j++ j {
                    if (chS[i + j] != chT[j]) {
                        cur++;
                    } 
            } {
                    if (chS[i + j] != chT[j]) {
                        cur++;
                    } 
            } if (chS[i + j] != chT[j]) {
                        cur++;
                    } chS[i + j] != chT[j] chS[i + j] chS i + j i j chT[j] chT j {
                        cur++;
                    } cur++ cur min = Math.min(min, cur) min Math.min(min, cur) Math.min Math min cur System.out.println(min) System.out.println System.out System System.out min 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[] chS = s.toCharArray();
        char[] chT = t.toCharArray();
        int min = t.length(); 
        for (int i = 0; i <= s.length() - t.length(); i++) {
            int cur = 0; 
            for (int j = 0; j < t.length(); j++) {
                    if (chS[i + j] != chT[j]) {
                        cur++;
                    } 
            }
            min = Math.min(min, cur);
        }
        System.out.println(min);
	}
} public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        char[] chS = s.toCharArray();
        char[] chT = t.toCharArray();
        int min = t.length(); 
        for (int i = 0; i <= s.length() - t.length(); i++) {
            int cur = 0; 
            for (int j = 0; j < t.length(); j++) {
                    if (chS[i + j] != chT[j]) {
                        cur++;
                    } 
            }
            min = Math.min(min, cur);
        }
        System.out.println(min);
	}
} 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[] chS = s.toCharArray();
        char[] chT = t.toCharArray();
        int min = t.length(); 
        for (int i = 0; i <= s.length() - t.length(); i++) {
            int cur = 0; 
            for (int j = 0; j < t.length(); j++) {
                    if (chS[i + j] != chT[j]) {
                        cur++;
                    } 
            }
            min = Math.min(min, cur);
        }
        System.out.println(min);
	}
}