import java.util.Scanner;

/*

*/

public class Main {
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();

        String[] TEMP = T.split("");
        String[] TEMP_S = S.split("");

        int count = 0;
        for (int i = 0; i < TEMP_S.length - TEMP.length +1; i++) {
    		int temp = 0;
        	for (int j = 0; j < TEMP.length; j++) {
        		if (TEMP_S[i + j].equals(TEMP[j])) {
        			temp++;
        		}
        	}
    		if (temp > count) {
    			count = temp;
    		}
        }

        System.out.println(T.length() -count);
    }
} 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();
        String T = sc.next();

        String[] TEMP = T.split("");
        String[] TEMP_S = S.split("");

        int count = 0;
        for (int i = 0; i < TEMP_S.length - TEMP.length +1; i++) {
    		int temp = 0;
        	for (int j = 0; j < TEMP.length; j++) {
        		if (TEMP_S[i + j].equals(TEMP[j])) {
        			temp++;
        		}
        	}
    		if (temp > count) {
    			count = temp;
    		}
        }

        System.out.println(T.length() -count);
    }
} Main public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();

        String[] TEMP = T.split("");
        String[] TEMP_S = S.split("");

        int count = 0;
        for (int i = 0; i < TEMP_S.length - TEMP.length +1; i++) {
    		int temp = 0;
        	for (int j = 0; j < TEMP.length; j++) {
        		if (TEMP_S[i + j].equals(TEMP[j])) {
        			temp++;
        		}
        	}
    		if (temp > count) {
    			count = temp;
    		}
        }

        System.out.println(T.length() -count);
    } main {

        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();

        String[] TEMP = T.split("");
        String[] TEMP_S = S.split("");

        int count = 0;
        for (int i = 0; i < TEMP_S.length - TEMP.length +1; i++) {
    		int temp = 0;
        	for (int j = 0; j < TEMP.length; j++) {
        		if (TEMP_S[i + j].equals(TEMP[j])) {
        			temp++;
        		}
        	}
    		if (temp > count) {
    			count = temp;
    		}
        }

        System.out.println(T.length() -count);
    } 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 String[] TEMP = T.split(""); TEMP T.split("") T.split T "" String[] TEMP_S = S.split(""); TEMP_S S.split("") S.split S "" int count = 0; count 0 for (int i = 0; i < TEMP_S.length - TEMP.length +1; i++) {
    		int temp = 0;
        	for (int j = 0; j < TEMP.length; j++) {
        		if (TEMP_S[i + j].equals(TEMP[j])) {
        			temp++;
        		}
        	}
    		if (temp > count) {
    			count = temp;
    		}
        } int i = 0; int i = 0; i 0 i < TEMP_S.length - TEMP.length +1 i TEMP_S.length - TEMP.length +1 TEMP_S.length - TEMP.length TEMP_S.length TEMP_S TEMP_S.length TEMP.length TEMP TEMP.length 1 i++ i++ i {
    		int temp = 0;
        	for (int j = 0; j < TEMP.length; j++) {
        		if (TEMP_S[i + j].equals(TEMP[j])) {
        			temp++;
        		}
        	}
    		if (temp > count) {
    			count = temp;
    		}
        } {
    		int temp = 0;
        	for (int j = 0; j < TEMP.length; j++) {
        		if (TEMP_S[i + j].equals(TEMP[j])) {
        			temp++;
        		}
        	}
    		if (temp > count) {
    			count = temp;
    		}
        } int temp = 0; temp 0 for (int j = 0; j < TEMP.length; j++) {
        		if (TEMP_S[i + j].equals(TEMP[j])) {
        			temp++;
        		}
        	} int j = 0; int j = 0; j 0 j < TEMP.length j TEMP.length TEMP TEMP.length j++ j++ j {
        		if (TEMP_S[i + j].equals(TEMP[j])) {
        			temp++;
        		}
        	} {
        		if (TEMP_S[i + j].equals(TEMP[j])) {
        			temp++;
        		}
        	} if (TEMP_S[i + j].equals(TEMP[j])) {
        			temp++;
        		} TEMP_S[i + j].equals(TEMP[j]) TEMP_S[i + j].equals TEMP_S[i + j] TEMP_S i + j i j TEMP[j] TEMP j {
        			temp++;
        		} temp++ temp if (temp > count) {
    			count = temp;
    		} temp > count temp count {
    			count = temp;
    		} count = temp count temp System.out.println(T.length() -count) System.out.println System.out System System.out T.length() -count T.length() T.length T count 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();

        String[] TEMP = T.split("");
        String[] TEMP_S = S.split("");

        int count = 0;
        for (int i = 0; i < TEMP_S.length - TEMP.length +1; i++) {
    		int temp = 0;
        	for (int j = 0; j < TEMP.length; j++) {
        		if (TEMP_S[i + j].equals(TEMP[j])) {
        			temp++;
        		}
        	}
    		if (temp > count) {
    			count = temp;
    		}
        }

        System.out.println(T.length() -count);
    }
} public class Main {
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();

        String[] TEMP = T.split("");
        String[] TEMP_S = S.split("");

        int count = 0;
        for (int i = 0; i < TEMP_S.length - TEMP.length +1; i++) {
    		int temp = 0;
        	for (int j = 0; j < TEMP.length; j++) {
        		if (TEMP_S[i + j].equals(TEMP[j])) {
        			temp++;
        		}
        	}
    		if (temp > count) {
    			count = temp;
    		}
        }

        System.out.println(T.length() -count);
    }
} Main
import java.util.Scanner;

/*

*/

public class Main {
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();

        String[] TEMP = T.split("");
        String[] TEMP_S = S.split("");

        int count = 0;
        for (int i = 0; i < TEMP_S.length - TEMP.length +1; i++) {
    		int temp = 0;
        	for (int j = 0; j < TEMP.length; j++) {
        		if (TEMP_S[i + j].equals(TEMP[j])) {
        			temp++;
        		}
        	}
    		if (temp > count) {
    			count = temp;
    		}
        }

        System.out.println(T.length() -count);
    }
}