import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws Exception {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	char S[] = br.readLine().toCharArray();
	char T[] = br.readLine().toCharArray();
	int roop = S.length - T.length + 1;
	int cnt[] = new int[roop];
	int max = 0;
	for (int i = 0; i < roop; i++) {
	    for (int j = 0; j < T.length; j++) {
		if (T[j] == S[i + j]) {
		    cnt[i]++;
		}
	    }
	}

	for (int k = 0; k < cnt.length; k++) {
	    if (max < cnt[k]) {
		max = cnt[k];
	    }
	}

	System.out.println(T.length - max);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

    public static void main(String[] args) throws Exception {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	char S[] = br.readLine().toCharArray();
	char T[] = br.readLine().toCharArray();
	int roop = S.length - T.length + 1;
	int cnt[] = new int[roop];
	int max = 0;
	for (int i = 0; i < roop; i++) {
	    for (int j = 0; j < T.length; j++) {
		if (T[j] == S[i + j]) {
		    cnt[i]++;
		}
	    }
	}

	for (int k = 0; k < cnt.length; k++) {
	    if (max < cnt[k]) {
		max = cnt[k];
	    }
	}

	System.out.println(T.length - max);
    }
} Main public static void main(String[] args) throws Exception {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	char S[] = br.readLine().toCharArray();
	char T[] = br.readLine().toCharArray();
	int roop = S.length - T.length + 1;
	int cnt[] = new int[roop];
	int max = 0;
	for (int i = 0; i < roop; i++) {
	    for (int j = 0; j < T.length; j++) {
		if (T[j] == S[i + j]) {
		    cnt[i]++;
		}
	    }
	}

	for (int k = 0; k < cnt.length; k++) {
	    if (max < cnt[k]) {
		max = cnt[k];
	    }
	}

	System.out.println(T.length - max);
    } main {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	char S[] = br.readLine().toCharArray();
	char T[] = br.readLine().toCharArray();
	int roop = S.length - T.length + 1;
	int cnt[] = new int[roop];
	int max = 0;
	for (int i = 0; i < roop; i++) {
	    for (int j = 0; j < T.length; j++) {
		if (T[j] == S[i + j]) {
		    cnt[i]++;
		}
	    }
	}

	for (int k = 0; k < cnt.length; k++) {
	    if (max < cnt[k]) {
		max = cnt[k];
	    }
	}

	System.out.println(T.length - max);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) char S[] = br.readLine().toCharArray(); S br.readLine().toCharArray() br.readLine().toCharArray br.readLine() br.readLine br char T[] = br.readLine().toCharArray(); T br.readLine().toCharArray() br.readLine().toCharArray br.readLine() br.readLine br int roop = S.length - T.length + 1; roop S.length - T.length + 1 S.length - T.length S.length S S.length T.length T T.length 1 int cnt[] = new int[roop]; cnt new int[roop] roop int max = 0; max 0 for (int i = 0; i < roop; i++) {
	    for (int j = 0; j < T.length; j++) {
		if (T[j] == S[i + j]) {
		    cnt[i]++;
		}
	    }
	} int i = 0; int i = 0; i 0 i < roop i roop i++ i++ i {
	    for (int j = 0; j < T.length; j++) {
		if (T[j] == S[i + j]) {
		    cnt[i]++;
		}
	    }
	} {
	    for (int j = 0; j < T.length; j++) {
		if (T[j] == S[i + j]) {
		    cnt[i]++;
		}
	    }
	} for (int j = 0; j < T.length; j++) {
		if (T[j] == S[i + j]) {
		    cnt[i]++;
		}
	    } int j = 0; int j = 0; j 0 j < T.length j T.length T T.length j++ j++ j {
		if (T[j] == S[i + j]) {
		    cnt[i]++;
		}
	    } {
		if (T[j] == S[i + j]) {
		    cnt[i]++;
		}
	    } if (T[j] == S[i + j]) {
		    cnt[i]++;
		} T[j] == S[i + j] T[j] T j S[i + j] S i + j i j {
		    cnt[i]++;
		} cnt[i]++ cnt[i] cnt i for (int k = 0; k < cnt.length; k++) {
	    if (max < cnt[k]) {
		max = cnt[k];
	    }
	} int k = 0; int k = 0; k 0 k < cnt.length k cnt.length cnt cnt.length k++ k++ k {
	    if (max < cnt[k]) {
		max = cnt[k];
	    }
	} {
	    if (max < cnt[k]) {
		max = cnt[k];
	    }
	} if (max < cnt[k]) {
		max = cnt[k];
	    } max < cnt[k] max cnt[k] cnt k {
		max = cnt[k];
	    } max = cnt[k] max cnt[k] cnt k System.out.println(T.length - max) System.out.println System.out System System.out T.length - max T.length T T.length max String[] args args public class Main {

    public static void main(String[] args) throws Exception {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	char S[] = br.readLine().toCharArray();
	char T[] = br.readLine().toCharArray();
	int roop = S.length - T.length + 1;
	int cnt[] = new int[roop];
	int max = 0;
	for (int i = 0; i < roop; i++) {
	    for (int j = 0; j < T.length; j++) {
		if (T[j] == S[i + j]) {
		    cnt[i]++;
		}
	    }
	}

	for (int k = 0; k < cnt.length; k++) {
	    if (max < cnt[k]) {
		max = cnt[k];
	    }
	}

	System.out.println(T.length - max);
    }
} public class Main {

    public static void main(String[] args) throws Exception {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	char S[] = br.readLine().toCharArray();
	char T[] = br.readLine().toCharArray();
	int roop = S.length - T.length + 1;
	int cnt[] = new int[roop];
	int max = 0;
	for (int i = 0; i < roop; i++) {
	    for (int j = 0; j < T.length; j++) {
		if (T[j] == S[i + j]) {
		    cnt[i]++;
		}
	    }
	}

	for (int k = 0; k < cnt.length; k++) {
	    if (max < cnt[k]) {
		max = cnt[k];
	    }
	}

	System.out.println(T.length - max);
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws Exception {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	char S[] = br.readLine().toCharArray();
	char T[] = br.readLine().toCharArray();
	int roop = S.length - T.length + 1;
	int cnt[] = new int[roop];
	int max = 0;
	for (int i = 0; i < roop; i++) {
	    for (int j = 0; j < T.length; j++) {
		if (T[j] == S[i + j]) {
		    cnt[i]++;
		}
	    }
	}

	for (int k = 0; k < cnt.length; k++) {
	    if (max < cnt[k]) {
		max = cnt[k];
	    }
	}

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