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();

		sc.close();

		int result = T.length();

		for (int i = 0; i < S.length() - T.length() + 1; i++) {
			String SS = S.substring(i, T.length() + i);
			int temp = 0;
			for (int j = 0; j < T.length(); j++) {
				if (SS.charAt(j) != T.charAt(j)) {
					temp++;
				}
			}
			if (temp < result) {
				result = temp;
			}
		}

		System.out.print(result);
	}

} 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();

		sc.close();

		int result = T.length();

		for (int i = 0; i < S.length() - T.length() + 1; i++) {
			String SS = S.substring(i, T.length() + i);
			int temp = 0;
			for (int j = 0; j < T.length(); j++) {
				if (SS.charAt(j) != T.charAt(j)) {
					temp++;
				}
			}
			if (temp < result) {
				result = temp;
			}
		}

		System.out.print(result);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();

		sc.close();

		int result = T.length();

		for (int i = 0; i < S.length() - T.length() + 1; i++) {
			String SS = S.substring(i, T.length() + i);
			int temp = 0;
			for (int j = 0; j < T.length(); j++) {
				if (SS.charAt(j) != T.charAt(j)) {
					temp++;
				}
			}
			if (temp < result) {
				result = temp;
			}
		}

		System.out.print(result);
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();

		sc.close();

		int result = T.length();

		for (int i = 0; i < S.length() - T.length() + 1; i++) {
			String SS = S.substring(i, T.length() + i);
			int temp = 0;
			for (int j = 0; j < T.length(); j++) {
				if (SS.charAt(j) != T.charAt(j)) {
					temp++;
				}
			}
			if (temp < result) {
				result = temp;
			}
		}

		System.out.print(result);
	} 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 sc.close() sc.close sc int result = T.length(); result T.length() T.length T for (int i = 0; i < S.length() - T.length() + 1; i++) {
			String SS = S.substring(i, T.length() + i);
			int temp = 0;
			for (int j = 0; j < T.length(); j++) {
				if (SS.charAt(j) != T.charAt(j)) {
					temp++;
				}
			}
			if (temp < result) {
				result = temp;
			}
		} 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 {
			String SS = S.substring(i, T.length() + i);
			int temp = 0;
			for (int j = 0; j < T.length(); j++) {
				if (SS.charAt(j) != T.charAt(j)) {
					temp++;
				}
			}
			if (temp < result) {
				result = temp;
			}
		} {
			String SS = S.substring(i, T.length() + i);
			int temp = 0;
			for (int j = 0; j < T.length(); j++) {
				if (SS.charAt(j) != T.charAt(j)) {
					temp++;
				}
			}
			if (temp < result) {
				result = temp;
			}
		} String SS = S.substring(i, T.length() + i); SS S.substring(i, T.length() + i) S.substring S i T.length() + i T.length() T.length T i int temp = 0; temp 0 for (int j = 0; j < T.length(); j++) {
				if (SS.charAt(j) != T.charAt(j)) {
					temp++;
				}
			} int j = 0; int j = 0; j 0 j < T.length() j T.length() T.length T j++ j++ j {
				if (SS.charAt(j) != T.charAt(j)) {
					temp++;
				}
			} {
				if (SS.charAt(j) != T.charAt(j)) {
					temp++;
				}
			} if (SS.charAt(j) != T.charAt(j)) {
					temp++;
				} SS.charAt(j) != T.charAt(j) SS.charAt(j) SS.charAt SS j T.charAt(j) T.charAt T j {
					temp++;
				} temp++ temp if (temp < result) {
				result = temp;
			} temp < result temp result {
				result = temp;
			} result = temp result temp System.out.print(result) System.out.print System.out System System.out result 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();

		sc.close();

		int result = T.length();

		for (int i = 0; i < S.length() - T.length() + 1; i++) {
			String SS = S.substring(i, T.length() + i);
			int temp = 0;
			for (int j = 0; j < T.length(); j++) {
				if (SS.charAt(j) != T.charAt(j)) {
					temp++;
				}
			}
			if (temp < result) {
				result = temp;
			}
		}

		System.out.print(result);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();

		sc.close();

		int result = T.length();

		for (int i = 0; i < S.length() - T.length() + 1; i++) {
			String SS = S.substring(i, T.length() + i);
			int temp = 0;
			for (int j = 0; j < T.length(); j++) {
				if (SS.charAt(j) != T.charAt(j)) {
					temp++;
				}
			}
			if (temp < result) {
				result = temp;
			}
		}

		System.out.print(result);
	}

} 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();

		sc.close();

		int result = T.length();

		for (int i = 0; i < S.length() - T.length() + 1; i++) {
			String SS = S.substring(i, T.length() + i);
			int temp = 0;
			for (int j = 0; j < T.length(); j++) {
				if (SS.charAt(j) != T.charAt(j)) {
					temp++;
				}
			}
			if (temp < result) {
				result = temp;
			}
		}

		System.out.print(result);
	}

}
