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 max = 0;
		for (int i = 0; i < s.length() -  t.length() + 1; i++) {
			String a = s.substring(i, t.length() + i);
			int cnt = 0;
			for (int j = 0; j < t.length(); j++) {
				if (a.charAt(j) == t.charAt(j)) cnt++;
			}
			max = Math.max(max, cnt);
		}

		System.out.println(t.length() - max);

		sc.close();

	}

} 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 max = 0;
		for (int i = 0; i < s.length() -  t.length() + 1; i++) {
			String a = s.substring(i, t.length() + i);
			int cnt = 0;
			for (int j = 0; j < t.length(); j++) {
				if (a.charAt(j) == t.charAt(j)) cnt++;
			}
			max = Math.max(max, cnt);
		}

		System.out.println(t.length() - max);

		sc.close();

	}

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

		int max = 0;
		for (int i = 0; i < s.length() -  t.length() + 1; i++) {
			String a = s.substring(i, t.length() + i);
			int cnt = 0;
			for (int j = 0; j < t.length(); j++) {
				if (a.charAt(j) == t.charAt(j)) cnt++;
			}
			max = Math.max(max, cnt);
		}

		System.out.println(t.length() - max);

		sc.close();

	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();

		int max = 0;
		for (int i = 0; i < s.length() -  t.length() + 1; i++) {
			String a = s.substring(i, t.length() + i);
			int cnt = 0;
			for (int j = 0; j < t.length(); j++) {
				if (a.charAt(j) == t.charAt(j)) cnt++;
			}
			max = Math.max(max, cnt);
		}

		System.out.println(t.length() - max);

		sc.close();

	} 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 max = 0; max 0 for (int i = 0; i < s.length() -  t.length() + 1; i++) {
			String a = s.substring(i, t.length() + i);
			int cnt = 0;
			for (int j = 0; j < t.length(); j++) {
				if (a.charAt(j) == t.charAt(j)) cnt++;
			}
			max = Math.max(max, cnt);
		} 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 a = s.substring(i, t.length() + i);
			int cnt = 0;
			for (int j = 0; j < t.length(); j++) {
				if (a.charAt(j) == t.charAt(j)) cnt++;
			}
			max = Math.max(max, cnt);
		} {
			String a = s.substring(i, t.length() + i);
			int cnt = 0;
			for (int j = 0; j < t.length(); j++) {
				if (a.charAt(j) == t.charAt(j)) cnt++;
			}
			max = Math.max(max, cnt);
		} String a = s.substring(i, t.length() + i); a s.substring(i, t.length() + i) s.substring s i t.length() + i t.length() t.length t i int cnt = 0; cnt 0 for (int j = 0; j < t.length(); j++) {
				if (a.charAt(j) == t.charAt(j)) cnt++;
			} int j = 0; int j = 0; j 0 j < t.length() j t.length() t.length t j++ j++ j {
				if (a.charAt(j) == t.charAt(j)) cnt++;
			} {
				if (a.charAt(j) == t.charAt(j)) cnt++;
			} if (a.charAt(j) == t.charAt(j)) cnt++; a.charAt(j) == t.charAt(j) a.charAt(j) a.charAt a j t.charAt(j) t.charAt t j cnt++ cnt max = Math.max(max, cnt) max Math.max(max, cnt) Math.max Math max cnt System.out.println(t.length() - max) System.out.println System.out System System.out t.length() - max t.length() t.length t max sc.close() sc.close sc 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 max = 0;
		for (int i = 0; i < s.length() -  t.length() + 1; i++) {
			String a = s.substring(i, t.length() + i);
			int cnt = 0;
			for (int j = 0; j < t.length(); j++) {
				if (a.charAt(j) == t.charAt(j)) cnt++;
			}
			max = Math.max(max, cnt);
		}

		System.out.println(t.length() - max);

		sc.close();

	}

} public class Main {

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

		int max = 0;
		for (int i = 0; i < s.length() -  t.length() + 1; i++) {
			String a = s.substring(i, t.length() + i);
			int cnt = 0;
			for (int j = 0; j < t.length(); j++) {
				if (a.charAt(j) == t.charAt(j)) cnt++;
			}
			max = Math.max(max, cnt);
		}

		System.out.println(t.length() - max);

		sc.close();

	}

} 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 max = 0;
		for (int i = 0; i < s.length() -  t.length() + 1; i++) {
			String a = s.substring(i, t.length() + i);
			int cnt = 0;
			for (int j = 0; j < t.length(); j++) {
				if (a.charAt(j) == t.charAt(j)) cnt++;
			}
			max = Math.max(max, cnt);
		}

		System.out.println(t.length() - max);

		sc.close();

	}

}