import java.util.Scanner;

public class Main {

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();

		int ans = t.length;

		for(int i = 0; i <= s.length - t.length; i++) {
			int diff = 0;
			for(int x = 0; x < t.length; x++) {
				if(t[x] != s[i+x]) {
					diff++;
				}
			}
			ans = ans <= diff ? ans : diff;
		}

		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();

		int ans = t.length;

		for(int i = 0; i <= s.length - t.length; i++) {
			int diff = 0;
			for(int x = 0; x < t.length; x++) {
				if(t[x] != s[i+x]) {
					diff++;
				}
			}
			ans = ans <= diff ? ans : diff;
		}

		System.out.println(ans);
	}
} Main public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();

		int ans = t.length;

		for(int i = 0; i <= s.length - t.length; i++) {
			int diff = 0;
			for(int x = 0; x < t.length; x++) {
				if(t[x] != s[i+x]) {
					diff++;
				}
			}
			ans = ans <= diff ? ans : diff;
		}

		System.out.println(ans);
	} main {

		Scanner sc = new Scanner(System.in);

		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();

		int ans = t.length;

		for(int i = 0; i <= s.length - t.length; i++) {
			int diff = 0;
			for(int x = 0; x < t.length; x++) {
				if(t[x] != s[i+x]) {
					diff++;
				}
			}
			ans = ans <= diff ? ans : diff;
		}

		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] s = sc.next().toCharArray(); s sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc char[] t = sc.next().toCharArray(); t sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc int ans = t.length; ans t.length t t.length for(int i = 0; i <= s.length - t.length; i++) {
			int diff = 0;
			for(int x = 0; x < t.length; x++) {
				if(t[x] != s[i+x]) {
					diff++;
				}
			}
			ans = ans <= diff ? ans : diff;
		} int i = 0; int i = 0; i 0 i <= s.length - t.length i s.length - t.length s.length s s.length t.length t t.length i++ i++ i {
			int diff = 0;
			for(int x = 0; x < t.length; x++) {
				if(t[x] != s[i+x]) {
					diff++;
				}
			}
			ans = ans <= diff ? ans : diff;
		} {
			int diff = 0;
			for(int x = 0; x < t.length; x++) {
				if(t[x] != s[i+x]) {
					diff++;
				}
			}
			ans = ans <= diff ? ans : diff;
		} int diff = 0; diff 0 for(int x = 0; x < t.length; x++) {
				if(t[x] != s[i+x]) {
					diff++;
				}
			} int x = 0; int x = 0; x 0 x < t.length x t.length t t.length x++ x++ x {
				if(t[x] != s[i+x]) {
					diff++;
				}
			} {
				if(t[x] != s[i+x]) {
					diff++;
				}
			} if(t[x] != s[i+x]) {
					diff++;
				} t[x] != s[i+x] t[x] t x s[i+x] s i+x i x {
					diff++;
				} diff++ diff ans = ans <= diff ? ans : diff ans ans <= diff ? ans : diff ans <= diff ans diff ans diff System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();

		int ans = t.length;

		for(int i = 0; i <= s.length - t.length; i++) {
			int diff = 0;
			for(int x = 0; x < t.length; x++) {
				if(t[x] != s[i+x]) {
					diff++;
				}
			}
			ans = ans <= diff ? ans : diff;
		}

		System.out.println(ans);
	}
} public class Main {

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();

		int ans = t.length;

		for(int i = 0; i <= s.length - t.length; i++) {
			int diff = 0;
			for(int x = 0; x < t.length; x++) {
				if(t[x] != s[i+x]) {
					diff++;
				}
			}
			ans = ans <= diff ? ans : diff;
		}

		System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();

		int ans = t.length;

		for(int i = 0; i <= s.length - t.length; i++) {
			int diff = 0;
			for(int x = 0; x < t.length; x++) {
				if(t[x] != s[i+x]) {
					diff++;
				}
			}
			ans = ans <= diff ? ans : diff;
		}

		System.out.println(ans);
	}
}
