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

		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 = Math.min(ans, diff);
		}

		System.out.println(ans);
	}


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

		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 = Math.min(ans, diff);
		}

		System.out.println(ans);
	}


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


		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String T = sc.next();

		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 = Math.min(ans, diff);
		}

		System.out.println(ans);
	} main {


		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String T = sc.next();

		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 = Math.min(ans, diff);
		}

		System.out.println(ans);
	} 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 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 = Math.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 = Math.min(ans, diff);
		} {

			int diff = 0;

			for (int i = 0; i < T.length(); i++) {
				if (T.charAt(i) != S.charAt(start + i)){
					diff++;
				}
			}
			ans = Math.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 = Math.min(ans, diff) ans Math.min(ans, diff) Math.min Math ans diff System.out.println(ans) System.out.println System.out System System.out ans 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();

		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 = Math.min(ans, diff);
		}

		System.out.println(ans);
	}


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


		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String T = sc.next();

		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 = Math.min(ans, diff);
		}

		System.out.println(ans);
	}


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

		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 = Math.min(ans, diff);
		}

		System.out.println(ans);
	}


}