import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);

		String a = sc.next();
		String b = sc.next();

		int a_length = a.length();
		int b_length = b.length();

		int loop_cnt = a_length - b_length + 1;
		int answer = b_length;

		for (int i = 0; i < loop_cnt; i++) {
			int change_cnt = 0;
			for (int j = 0; j < b_length; j++) {
				if (a.charAt(i + j) != b.charAt(j)) {
					change_cnt++;
				}
			}
			if (change_cnt < answer) {
				answer = change_cnt;
			}
		}
		System.out.println(answer);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String a = sc.next();
		String b = sc.next();

		int a_length = a.length();
		int b_length = b.length();

		int loop_cnt = a_length - b_length + 1;
		int answer = b_length;

		for (int i = 0; i < loop_cnt; i++) {
			int change_cnt = 0;
			for (int j = 0; j < b_length; j++) {
				if (a.charAt(i + j) != b.charAt(j)) {
					change_cnt++;
				}
			}
			if (change_cnt < answer) {
				answer = change_cnt;
			}
		}
		System.out.println(answer);
	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String a = sc.next();
		String b = sc.next();

		int a_length = a.length();
		int b_length = b.length();

		int loop_cnt = a_length - b_length + 1;
		int answer = b_length;

		for (int i = 0; i < loop_cnt; i++) {
			int change_cnt = 0;
			for (int j = 0; j < b_length; j++) {
				if (a.charAt(i + j) != b.charAt(j)) {
					change_cnt++;
				}
			}
			if (change_cnt < answer) {
				answer = change_cnt;
			}
		}
		System.out.println(answer);
	} main {

		Scanner sc = new Scanner(System.in);

		String a = sc.next();
		String b = sc.next();

		int a_length = a.length();
		int b_length = b.length();

		int loop_cnt = a_length - b_length + 1;
		int answer = b_length;

		for (int i = 0; i < loop_cnt; i++) {
			int change_cnt = 0;
			for (int j = 0; j < b_length; j++) {
				if (a.charAt(i + j) != b.charAt(j)) {
					change_cnt++;
				}
			}
			if (change_cnt < answer) {
				answer = change_cnt;
			}
		}
		System.out.println(answer);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String a = sc.next(); a sc.next() sc.next sc String b = sc.next(); b sc.next() sc.next sc int a_length = a.length(); a_length a.length() a.length a int b_length = b.length(); b_length b.length() b.length b int loop_cnt = a_length - b_length + 1; loop_cnt a_length - b_length + 1 a_length - b_length a_length b_length 1 int answer = b_length; answer b_length for (int i = 0; i < loop_cnt; i++) {
			int change_cnt = 0;
			for (int j = 0; j < b_length; j++) {
				if (a.charAt(i + j) != b.charAt(j)) {
					change_cnt++;
				}
			}
			if (change_cnt < answer) {
				answer = change_cnt;
			}
		} int i = 0; int i = 0; i 0 i < loop_cnt i loop_cnt i++ i++ i {
			int change_cnt = 0;
			for (int j = 0; j < b_length; j++) {
				if (a.charAt(i + j) != b.charAt(j)) {
					change_cnt++;
				}
			}
			if (change_cnt < answer) {
				answer = change_cnt;
			}
		} {
			int change_cnt = 0;
			for (int j = 0; j < b_length; j++) {
				if (a.charAt(i + j) != b.charAt(j)) {
					change_cnt++;
				}
			}
			if (change_cnt < answer) {
				answer = change_cnt;
			}
		} int change_cnt = 0; change_cnt 0 for (int j = 0; j < b_length; j++) {
				if (a.charAt(i + j) != b.charAt(j)) {
					change_cnt++;
				}
			} int j = 0; int j = 0; j 0 j < b_length j b_length j++ j++ j {
				if (a.charAt(i + j) != b.charAt(j)) {
					change_cnt++;
				}
			} {
				if (a.charAt(i + j) != b.charAt(j)) {
					change_cnt++;
				}
			} if (a.charAt(i + j) != b.charAt(j)) {
					change_cnt++;
				} a.charAt(i + j) != b.charAt(j) a.charAt(i + j) a.charAt a i + j i j b.charAt(j) b.charAt b j {
					change_cnt++;
				} change_cnt++ change_cnt if (change_cnt < answer) {
				answer = change_cnt;
			} change_cnt < answer change_cnt answer {
				answer = change_cnt;
			} answer = change_cnt answer change_cnt System.out.println(answer) System.out.println System.out System System.out answer String[] args args public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String a = sc.next();
		String b = sc.next();

		int a_length = a.length();
		int b_length = b.length();

		int loop_cnt = a_length - b_length + 1;
		int answer = b_length;

		for (int i = 0; i < loop_cnt; i++) {
			int change_cnt = 0;
			for (int j = 0; j < b_length; j++) {
				if (a.charAt(i + j) != b.charAt(j)) {
					change_cnt++;
				}
			}
			if (change_cnt < answer) {
				answer = change_cnt;
			}
		}
		System.out.println(answer);
	}
} public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String a = sc.next();
		String b = sc.next();

		int a_length = a.length();
		int b_length = b.length();

		int loop_cnt = a_length - b_length + 1;
		int answer = b_length;

		for (int i = 0; i < loop_cnt; i++) {
			int change_cnt = 0;
			for (int j = 0; j < b_length; j++) {
				if (a.charAt(i + j) != b.charAt(j)) {
					change_cnt++;
				}
			}
			if (change_cnt < answer) {
				answer = change_cnt;
			}
		}
		System.out.println(answer);
	}
} Main
import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);

		String a = sc.next();
		String b = sc.next();

		int a_length = a.length();
		int b_length = b.length();

		int loop_cnt = a_length - b_length + 1;
		int answer = b_length;

		for (int i = 0; i < loop_cnt; i++) {
			int change_cnt = 0;
			for (int j = 0; j < b_length; j++) {
				if (a.charAt(i + j) != b.charAt(j)) {
					change_cnt++;
				}
			}
			if (change_cnt < answer) {
				answer = change_cnt;
			}
		}
		System.out.println(answer);
	}
}
