import 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 result = 0;
		for (int i = 0; i < s.length() - t.length() + 1; i++) {
			int score = 0;
			for (int j = 0; j < t.length(); j++) {

				//System.out.println(s.substring(i + j, i + j + 1) + " " + t.substring(j, j + 1));
				if (s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1))) {
					score++;
				}
			}
			if (result < score) {
				result = score;
			}
		}

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

	}
} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {

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

		int result = 0;
		for (int i = 0; i < s.length() - t.length() + 1; i++) {
			int score = 0;
			for (int j = 0; j < t.length(); j++) {

				//System.out.println(s.substring(i + j, i + j + 1) + " " + t.substring(j, j + 1));
				if (s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1))) {
					score++;
				}
			}
			if (result < score) {
				result = score;
			}
		}

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

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

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

		int result = 0;
		for (int i = 0; i < s.length() - t.length() + 1; i++) {
			int score = 0;
			for (int j = 0; j < t.length(); j++) {

				//System.out.println(s.substring(i + j, i + j + 1) + " " + t.substring(j, j + 1));
				if (s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1))) {
					score++;
				}
			}
			if (result < score) {
				result = score;
			}
		}

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

	} main {

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

		int result = 0;
		for (int i = 0; i < s.length() - t.length() + 1; i++) {
			int score = 0;
			for (int j = 0; j < t.length(); j++) {

				//System.out.println(s.substring(i + j, i + j + 1) + " " + t.substring(j, j + 1));
				if (s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1))) {
					score++;
				}
			}
			if (result < score) {
				result = score;
			}
		}

		System.out.println(t.length() - 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 int result = 0; result 0 for (int i = 0; i < s.length() - t.length() + 1; i++) {
			int score = 0;
			for (int j = 0; j < t.length(); j++) {

				//System.out.println(s.substring(i + j, i + j + 1) + " " + t.substring(j, j + 1));
				if (s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1))) {
					score++;
				}
			}
			if (result < score) {
				result = score;
			}
		} 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 {
			int score = 0;
			for (int j = 0; j < t.length(); j++) {

				//System.out.println(s.substring(i + j, i + j + 1) + " " + t.substring(j, j + 1));
				if (s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1))) {
					score++;
				}
			}
			if (result < score) {
				result = score;
			}
		} {
			int score = 0;
			for (int j = 0; j < t.length(); j++) {

				//System.out.println(s.substring(i + j, i + j + 1) + " " + t.substring(j, j + 1));
				if (s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1))) {
					score++;
				}
			}
			if (result < score) {
				result = score;
			}
		} int score = 0; score 0 for (int j = 0; j < t.length(); j++) {

				//System.out.println(s.substring(i + j, i + j + 1) + " " + t.substring(j, j + 1));
				if (s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1))) {
					score++;
				}
			} int j = 0; int j = 0; j 0 j < t.length() j t.length() t.length t j++ j++ j {

				//System.out.println(s.substring(i + j, i + j + 1) + " " + t.substring(j, j + 1));
				if (s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1))) {
					score++;
				}
			} {

				//System.out.println(s.substring(i + j, i + j + 1) + " " + t.substring(j, j + 1));
				if (s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1))) {
					score++;
				}
			} if (s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1))) {
					score++;
				} s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1)) s.substring(i + j, i + j + 1).equals s.substring(i + j, i + j + 1) s.substring s i + j i j i + j + 1 i + j + 1 i j 1 t.substring(j, j + 1) t.substring t j j + 1 j 1 {
					score++;
				} score++ score if (result < score) {
				result = score;
			} result < score result score {
				result = score;
			} result = score result score System.out.println(t.length() - result) System.out.println System.out System System.out t.length() - result t.length() t.length t 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();

		int result = 0;
		for (int i = 0; i < s.length() - t.length() + 1; i++) {
			int score = 0;
			for (int j = 0; j < t.length(); j++) {

				//System.out.println(s.substring(i + j, i + j + 1) + " " + t.substring(j, j + 1));
				if (s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1))) {
					score++;
				}
			}
			if (result < score) {
				result = score;
			}
		}

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

	}
} public class Main {

	public static void main(String[] args) {

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

		int result = 0;
		for (int i = 0; i < s.length() - t.length() + 1; i++) {
			int score = 0;
			for (int j = 0; j < t.length(); j++) {

				//System.out.println(s.substring(i + j, i + j + 1) + " " + t.substring(j, j + 1));
				if (s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1))) {
					score++;
				}
			}
			if (result < score) {
				result = score;
			}
		}

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

	}
} Main
import 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 result = 0;
		for (int i = 0; i < s.length() - t.length() + 1; i++) {
			int score = 0;
			for (int j = 0; j < t.length(); j++) {

				//System.out.println(s.substring(i + j, i + j + 1) + " " + t.substring(j, j + 1));
				if (s.substring(i + j, i + j + 1).equals(t.substring(j, j + 1))) {
					score++;
				}
			}
			if (result < score) {
				result = score;
			}
		}

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

	}
}
