import java.util.Scanner;

public class Main {

	static int solve(String s, String t) {
		int min = 1001;

		for (int i = 0; i < s.length() - t.length() + 1; i++) {
			int count = 0;
			for (int j = 0; j < t.length(); j++) {
				if (s.charAt(i + j) != t.charAt(j))
					count++;
			}
			if (count < min)
				min = count;
		}

		return min;
	}

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

		String s, t;
		s = stdIn.next();
		t = stdIn.next();
		int result = solve(s, t);
		System.out.println(result);

		stdIn.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	static int solve(String s, String t) {
		int min = 1001;

		for (int i = 0; i < s.length() - t.length() + 1; i++) {
			int count = 0;
			for (int j = 0; j < t.length(); j++) {
				if (s.charAt(i + j) != t.charAt(j))
					count++;
			}
			if (count < min)
				min = count;
		}

		return min;
	}

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

		String s, t;
		s = stdIn.next();
		t = stdIn.next();
		int result = solve(s, t);
		System.out.println(result);

		stdIn.close();
	}
} Main static int solve(String s, String t) {
		int min = 1001;

		for (int i = 0; i < s.length() - t.length() + 1; i++) {
			int count = 0;
			for (int j = 0; j < t.length(); j++) {
				if (s.charAt(i + j) != t.charAt(j))
					count++;
			}
			if (count < min)
				min = count;
		}

		return min;
	} solve {
		int min = 1001;

		for (int i = 0; i < s.length() - t.length() + 1; i++) {
			int count = 0;
			for (int j = 0; j < t.length(); j++) {
				if (s.charAt(i + j) != t.charAt(j))
					count++;
			}
			if (count < min)
				min = count;
		}

		return min;
	} int min = 1001; min 1001 for (int i = 0; i < s.length() - t.length() + 1; i++) {
			int count = 0;
			for (int j = 0; j < t.length(); j++) {
				if (s.charAt(i + j) != t.charAt(j))
					count++;
			}
			if (count < min)
				min = count;
		} 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 count = 0;
			for (int j = 0; j < t.length(); j++) {
				if (s.charAt(i + j) != t.charAt(j))
					count++;
			}
			if (count < min)
				min = count;
		} {
			int count = 0;
			for (int j = 0; j < t.length(); j++) {
				if (s.charAt(i + j) != t.charAt(j))
					count++;
			}
			if (count < min)
				min = count;
		} int count = 0; count 0 for (int j = 0; j < t.length(); j++) {
				if (s.charAt(i + j) != t.charAt(j))
					count++;
			} int j = 0; int j = 0; j 0 j < t.length() j t.length() t.length t j++ j++ j {
				if (s.charAt(i + j) != t.charAt(j))
					count++;
			} {
				if (s.charAt(i + j) != t.charAt(j))
					count++;
			} if (s.charAt(i + j) != t.charAt(j))
					count++; s.charAt(i + j) != t.charAt(j) s.charAt(i + j) s.charAt s i + j i j t.charAt(j) t.charAt t j count++ count if (count < min)
				min = count; count < min count min min = count min count return min; min String s s String t t public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);

		String s, t;
		s = stdIn.next();
		t = stdIn.next();
		int result = solve(s, t);
		System.out.println(result);

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

		String s, t;
		s = stdIn.next();
		t = stdIn.next();
		int result = solve(s, t);
		System.out.println(result);

		stdIn.close();
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) String s s t; t s = stdIn.next() s stdIn.next() stdIn.next stdIn t = stdIn.next() t stdIn.next() stdIn.next stdIn int result = solve(s, t); result solve(s, t) solve s t System.out.println(result) System.out.println System.out System System.out result stdIn.close() stdIn.close stdIn String[] args args public class Main {

	static int solve(String s, String t) {
		int min = 1001;

		for (int i = 0; i < s.length() - t.length() + 1; i++) {
			int count = 0;
			for (int j = 0; j < t.length(); j++) {
				if (s.charAt(i + j) != t.charAt(j))
					count++;
			}
			if (count < min)
				min = count;
		}

		return min;
	}

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

		String s, t;
		s = stdIn.next();
		t = stdIn.next();
		int result = solve(s, t);
		System.out.println(result);

		stdIn.close();
	}
} public class Main {

	static int solve(String s, String t) {
		int min = 1001;

		for (int i = 0; i < s.length() - t.length() + 1; i++) {
			int count = 0;
			for (int j = 0; j < t.length(); j++) {
				if (s.charAt(i + j) != t.charAt(j))
					count++;
			}
			if (count < min)
				min = count;
		}

		return min;
	}

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

		String s, t;
		s = stdIn.next();
		t = stdIn.next();
		int result = solve(s, t);
		System.out.println(result);

		stdIn.close();
	}
} Main
import java.util.Scanner;

public class Main {

	static int solve(String s, String t) {
		int min = 1001;

		for (int i = 0; i < s.length() - t.length() + 1; i++) {
			int count = 0;
			for (int j = 0; j < t.length(); j++) {
				if (s.charAt(i + j) != t.charAt(j))
					count++;
			}
			if (count < min)
				min = count;
		}

		return min;
	}

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

		String s, t;
		s = stdIn.next();
		t = stdIn.next();
		int result = solve(s, t);
		System.out.println(result);

		stdIn.close();
	}
}
