import java.util.Scanner;

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

		String S = sc.nextLine();

		String T = sc.nextLine();
		//int T = sc.nextInt();
		int ans = T.length();

		for(int start = 0; start <= S.length() - T.length(); start++) {
			int diff = 0;
			for(int i = 0; i<T.length();i++) {
				if(T.charAt(i) != S.charAt(start+i)) {
					diff++;
				}
			}
			ans = min(ans , diff);
		}

		System.out.print(ans);

    }

	static int min(int x,int y) {
		if(x>y) {
		return y;
		}
		else if(x<y) {
			return x;
		}
		else
			return x;
	}
}



//cabacc
//abc 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.nextLine();

		String T = sc.nextLine();
		//int T = sc.nextInt();
		int ans = T.length();

		for(int start = 0; start <= S.length() - T.length(); start++) {
			int diff = 0;
			for(int i = 0; i<T.length();i++) {
				if(T.charAt(i) != S.charAt(start+i)) {
					diff++;
				}
			}
			ans = min(ans , diff);
		}

		System.out.print(ans);

    }

	static int min(int x,int y) {
		if(x>y) {
		return y;
		}
		else if(x<y) {
			return x;
		}
		else
			return x;
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.nextLine();

		String T = sc.nextLine();
		//int T = sc.nextInt();
		int ans = T.length();

		for(int start = 0; start <= S.length() - T.length(); start++) {
			int diff = 0;
			for(int i = 0; i<T.length();i++) {
				if(T.charAt(i) != S.charAt(start+i)) {
					diff++;
				}
			}
			ans = min(ans , diff);
		}

		System.out.print(ans);

    } main {
		Scanner sc = new Scanner(System.in);

		String S = sc.nextLine();

		String T = sc.nextLine();
		//int T = sc.nextInt();
		int ans = T.length();

		for(int start = 0; start <= S.length() - T.length(); start++) {
			int diff = 0;
			for(int i = 0; i<T.length();i++) {
				if(T.charAt(i) != S.charAt(start+i)) {
					diff++;
				}
			}
			ans = min(ans , diff);
		}

		System.out.print(ans);

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.nextLine(); S sc.nextLine() sc.nextLine sc String T = sc.nextLine(); T sc.nextLine() sc.nextLine sc int ans = T.length(); ans T.length() T.length T for(int start = 0; start <= S.length() - T.length(); start++) {
			int diff = 0;
			for(int i = 0; i<T.length();i++) {
				if(T.charAt(i) != S.charAt(start+i)) {
					diff++;
				}
			}
			ans = min(ans , diff);
		} int start = 0; int start = 0; start 0 start <= S.length() - T.length() start S.length() - T.length() S.length() S.length S T.length() T.length T start++ start++ start {
			int diff = 0;
			for(int i = 0; i<T.length();i++) {
				if(T.charAt(i) != S.charAt(start+i)) {
					diff++;
				}
			}
			ans = min(ans , diff);
		} {
			int diff = 0;
			for(int i = 0; i<T.length();i++) {
				if(T.charAt(i) != S.charAt(start+i)) {
					diff++;
				}
			}
			ans = min(ans , diff);
		} int diff = 0; diff 0 for(int i = 0; i<T.length();i++) {
				if(T.charAt(i) != S.charAt(start+i)) {
					diff++;
				}
			} int i = 0; int i = 0; i 0 i<T.length() i T.length() T.length T i++ i++ i {
				if(T.charAt(i) != S.charAt(start+i)) {
					diff++;
				}
			} {
				if(T.charAt(i) != S.charAt(start+i)) {
					diff++;
				}
			} if(T.charAt(i) != S.charAt(start+i)) {
					diff++;
				} T.charAt(i) != S.charAt(start+i) T.charAt(i) T.charAt T i S.charAt(start+i) S.charAt S start+i start i {
					diff++;
				} diff++ diff ans = min(ans , diff) ans min(ans , diff) min ans diff System.out.print(ans) System.out.print System.out System System.out ans String[] args args static int min(int x,int y) {
		if(x>y) {
		return y;
		}
		else if(x<y) {
			return x;
		}
		else
			return x;
	} min {
		if(x>y) {
		return y;
		}
		else if(x<y) {
			return x;
		}
		else
			return x;
	} if(x>y) {
		return y;
		}
		else if(x<y) {
			return x;
		}
		else
			return x; x>y x y {
		return y;
		} return y; y if(x<y) {
			return x;
		}
		else
			return x; x<y x y {
			return x;
		} return x; x return x; x int x x int y y public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.nextLine();

		String T = sc.nextLine();
		//int T = sc.nextInt();
		int ans = T.length();

		for(int start = 0; start <= S.length() - T.length(); start++) {
			int diff = 0;
			for(int i = 0; i<T.length();i++) {
				if(T.charAt(i) != S.charAt(start+i)) {
					diff++;
				}
			}
			ans = min(ans , diff);
		}

		System.out.print(ans);

    }

	static int min(int x,int y) {
		if(x>y) {
		return y;
		}
		else if(x<y) {
			return x;
		}
		else
			return x;
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.nextLine();

		String T = sc.nextLine();
		//int T = sc.nextInt();
		int ans = T.length();

		for(int start = 0; start <= S.length() - T.length(); start++) {
			int diff = 0;
			for(int i = 0; i<T.length();i++) {
				if(T.charAt(i) != S.charAt(start+i)) {
					diff++;
				}
			}
			ans = min(ans , diff);
		}

		System.out.print(ans);

    }

	static int min(int x,int y) {
		if(x>y) {
		return y;
		}
		else if(x<y) {
			return x;
		}
		else
			return x;
	}
} Main
import java.util.Scanner;

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

		String S = sc.nextLine();

		String T = sc.nextLine();
		//int T = sc.nextInt();
		int ans = T.length();

		for(int start = 0; start <= S.length() - T.length(); start++) {
			int diff = 0;
			for(int i = 0; i<T.length();i++) {
				if(T.charAt(i) != S.charAt(start+i)) {
					diff++;
				}
			}
			ans = min(ans , diff);
		}

		System.out.print(ans);

    }

	static int min(int x,int y) {
		if(x>y) {
		return y;
		}
		else if(x<y) {
			return x;
		}
		else
			return x;
	}
}



//cabacc
//abc