import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {

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

	private static void execute21_2() {
		try (Scanner sc = new Scanner(System.in)) {
			String s = sc.next();
			String t = sc.next();

			int ans = 999999;

			for (int x = 0; x <= s.length() - t.length(); x++) {
				int a=0;
				for (int i = 0; i < t.length(); i++) {

					if (t.charAt(i) != s.charAt(i + x)) {
						a++;
					}
				}
				ans=Math.min(ans, a);
			}
			System.out.println(ans);
		}
	}
} import java.util.ArrayDeque; ArrayDeque java.util import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Comparator; Comparator java.util import java.util.Deque; Deque java.util import java.util.HashMap; HashMap java.util import java.util.HashSet; HashSet java.util import java.util.List; List java.util import java.util.Map; Map java.util import java.util.Queue; Queue java.util import java.util.Scanner; Scanner java.util import java.util.Set; Set java.util public class Main {

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

	private static void execute21_2() {
		try (Scanner sc = new Scanner(System.in)) {
			String s = sc.next();
			String t = sc.next();

			int ans = 999999;

			for (int x = 0; x <= s.length() - t.length(); x++) {
				int a=0;
				for (int i = 0; i < t.length(); i++) {

					if (t.charAt(i) != s.charAt(i + x)) {
						a++;
					}
				}
				ans=Math.min(ans, a);
			}
			System.out.println(ans);
		}
	}
} Main public static void main(String[] args) {
		execute21_2();
	} main {
		execute21_2();
	} execute21_2() execute21_2 String[] args args private static void execute21_2() {
		try (Scanner sc = new Scanner(System.in)) {
			String s = sc.next();
			String t = sc.next();

			int ans = 999999;

			for (int x = 0; x <= s.length() - t.length(); x++) {
				int a=0;
				for (int i = 0; i < t.length(); i++) {

					if (t.charAt(i) != s.charAt(i + x)) {
						a++;
					}
				}
				ans=Math.min(ans, a);
			}
			System.out.println(ans);
		}
	} execute21_2 {
		try (Scanner sc = new Scanner(System.in)) {
			String s = sc.next();
			String t = sc.next();

			int ans = 999999;

			for (int x = 0; x <= s.length() - t.length(); x++) {
				int a=0;
				for (int i = 0; i < t.length(); i++) {

					if (t.charAt(i) != s.charAt(i + x)) {
						a++;
					}
				}
				ans=Math.min(ans, a);
			}
			System.out.println(ans);
		}
	} try (Scanner sc = new Scanner(System.in)) {
			String s = sc.next();
			String t = sc.next();

			int ans = 999999;

			for (int x = 0; x <= s.length() - t.length(); x++) {
				int a=0;
				for (int i = 0; i < t.length(); i++) {

					if (t.charAt(i) != s.charAt(i + x)) {
						a++;
					}
				}
				ans=Math.min(ans, a);
			}
			System.out.println(ans);
		} {
			String s = sc.next();
			String t = sc.next();

			int ans = 999999;

			for (int x = 0; x <= s.length() - t.length(); x++) {
				int a=0;
				for (int i = 0; i < t.length(); i++) {

					if (t.charAt(i) != s.charAt(i + x)) {
						a++;
					}
				}
				ans=Math.min(ans, a);
			}
			System.out.println(ans);
		} Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) 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 = 999999; ans 999999 for (int x = 0; x <= s.length() - t.length(); x++) {
				int a=0;
				for (int i = 0; i < t.length(); i++) {

					if (t.charAt(i) != s.charAt(i + x)) {
						a++;
					}
				}
				ans=Math.min(ans, a);
			} int x = 0; int x = 0; x 0 x <= s.length() - t.length() x s.length() - t.length() s.length() s.length s t.length() t.length t x++ x++ x {
				int a=0;
				for (int i = 0; i < t.length(); i++) {

					if (t.charAt(i) != s.charAt(i + x)) {
						a++;
					}
				}
				ans=Math.min(ans, a);
			} {
				int a=0;
				for (int i = 0; i < t.length(); i++) {

					if (t.charAt(i) != s.charAt(i + x)) {
						a++;
					}
				}
				ans=Math.min(ans, a);
			} int a=0; a 0 for (int i = 0; i < t.length(); i++) {

					if (t.charAt(i) != s.charAt(i + x)) {
						a++;
					}
				} 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(i + x)) {
						a++;
					}
				} {

					if (t.charAt(i) != s.charAt(i + x)) {
						a++;
					}
				} if (t.charAt(i) != s.charAt(i + x)) {
						a++;
					} t.charAt(i) != s.charAt(i + x) t.charAt(i) t.charAt t i s.charAt(i + x) s.charAt s i + x i x {
						a++;
					} a++ a ans=Math.min(ans, a) ans Math.min(ans, a) Math.min Math ans a System.out.println(ans) System.out.println System.out System System.out ans public class Main {

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

	private static void execute21_2() {
		try (Scanner sc = new Scanner(System.in)) {
			String s = sc.next();
			String t = sc.next();

			int ans = 999999;

			for (int x = 0; x <= s.length() - t.length(); x++) {
				int a=0;
				for (int i = 0; i < t.length(); i++) {

					if (t.charAt(i) != s.charAt(i + x)) {
						a++;
					}
				}
				ans=Math.min(ans, a);
			}
			System.out.println(ans);
		}
	}
} public class Main {

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

	private static void execute21_2() {
		try (Scanner sc = new Scanner(System.in)) {
			String s = sc.next();
			String t = sc.next();

			int ans = 999999;

			for (int x = 0; x <= s.length() - t.length(); x++) {
				int a=0;
				for (int i = 0; i < t.length(); i++) {

					if (t.charAt(i) != s.charAt(i + x)) {
						a++;
					}
				}
				ans=Math.min(ans, a);
			}
			System.out.println(ans);
		}
	}
} Main
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {

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

	private static void execute21_2() {
		try (Scanner sc = new Scanner(System.in)) {
			String s = sc.next();
			String t = sc.next();

			int ans = 999999;

			for (int x = 0; x <= s.length() - t.length(); x++) {
				int a=0;
				for (int i = 0; i < t.length(); i++) {

					if (t.charAt(i) != s.charAt(i + x)) {
						a++;
					}
				}
				ans=Math.min(ans, a);
			}
			System.out.println(ans);
		}
	}
}