import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		solve(S, T);
	}

	private static void solve(String s, String t) {
		// TODO Auto-generated method stub
		int n = t.length(), l = s.length();
		List<String> subs = new ArrayList<String>();
		for (int i = 0; i <= l - n; i++) {
			subs.add(s.substring(i, i + n));
		}
//		System.out.println(subs.toString());
		int gm = Integer.MAX_VALUE;
		for (String ss : subs) {
			int lm = 0;
			for (int i = 0; i < ss.length(); i++) {
				if (ss.equals(t)) {
					System.out.println(0);
					return;
				} else if (ss.charAt(i) != t.charAt(i)) {
					lm++;
				}
			}
			gm = Math.min(gm, lm);
		}
		System.out.println(gm);
	}

} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		solve(S, T);
	}

	private static void solve(String s, String t) {
		// TODO Auto-generated method stub
		int n = t.length(), l = s.length();
		List<String> subs = new ArrayList<String>();
		for (int i = 0; i <= l - n; i++) {
			subs.add(s.substring(i, i + n));
		}
//		System.out.println(subs.toString());
		int gm = Integer.MAX_VALUE;
		for (String ss : subs) {
			int lm = 0;
			for (int i = 0; i < ss.length(); i++) {
				if (ss.equals(t)) {
					System.out.println(0);
					return;
				} else if (ss.charAt(i) != t.charAt(i)) {
					lm++;
				}
			}
			gm = Math.min(gm, lm);
		}
		System.out.println(gm);
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		solve(S, T);
	} main {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		solve(S, T);
	} 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 solve(S, T) solve S T String[] args args private static void solve(String s, String t) {
		// TODO Auto-generated method stub
		int n = t.length(), l = s.length();
		List<String> subs = new ArrayList<String>();
		for (int i = 0; i <= l - n; i++) {
			subs.add(s.substring(i, i + n));
		}
//		System.out.println(subs.toString());
		int gm = Integer.MAX_VALUE;
		for (String ss : subs) {
			int lm = 0;
			for (int i = 0; i < ss.length(); i++) {
				if (ss.equals(t)) {
					System.out.println(0);
					return;
				} else if (ss.charAt(i) != t.charAt(i)) {
					lm++;
				}
			}
			gm = Math.min(gm, lm);
		}
		System.out.println(gm);
	} solve {
		// TODO Auto-generated method stub
		int n = t.length(), l = s.length();
		List<String> subs = new ArrayList<String>();
		for (int i = 0; i <= l - n; i++) {
			subs.add(s.substring(i, i + n));
		}
//		System.out.println(subs.toString());
		int gm = Integer.MAX_VALUE;
		for (String ss : subs) {
			int lm = 0;
			for (int i = 0; i < ss.length(); i++) {
				if (ss.equals(t)) {
					System.out.println(0);
					return;
				} else if (ss.charAt(i) != t.charAt(i)) {
					lm++;
				}
			}
			gm = Math.min(gm, lm);
		}
		System.out.println(gm);
	} int n = t.length() n t.length() t.length t l = s.length(); l s.length() s.length s List<String> subs = new ArrayList<String>(); subs new ArrayList<String>() for (int i = 0; i <= l - n; i++) {
			subs.add(s.substring(i, i + n));
		} int i = 0; int i = 0; i 0 i <= l - n i l - n l n i++ i++ i {
			subs.add(s.substring(i, i + n));
		} {
			subs.add(s.substring(i, i + n));
		} subs.add(s.substring(i, i + n)) subs.add subs s.substring(i, i + n) s.substring s i i + n i n int gm = Integer.MAX_VALUE; gm Integer.MAX_VALUE Integer Integer.MAX_VALUE for (String ss : subs) {
			int lm = 0;
			for (int i = 0; i < ss.length(); i++) {
				if (ss.equals(t)) {
					System.out.println(0);
					return;
				} else if (ss.charAt(i) != t.charAt(i)) {
					lm++;
				}
			}
			gm = Math.min(gm, lm);
		} String ss subs {
			int lm = 0;
			for (int i = 0; i < ss.length(); i++) {
				if (ss.equals(t)) {
					System.out.println(0);
					return;
				} else if (ss.charAt(i) != t.charAt(i)) {
					lm++;
				}
			}
			gm = Math.min(gm, lm);
		} {
			int lm = 0;
			for (int i = 0; i < ss.length(); i++) {
				if (ss.equals(t)) {
					System.out.println(0);
					return;
				} else if (ss.charAt(i) != t.charAt(i)) {
					lm++;
				}
			}
			gm = Math.min(gm, lm);
		} int lm = 0; lm 0 for (int i = 0; i < ss.length(); i++) {
				if (ss.equals(t)) {
					System.out.println(0);
					return;
				} else if (ss.charAt(i) != t.charAt(i)) {
					lm++;
				}
			} int i = 0; int i = 0; i 0 i < ss.length() i ss.length() ss.length ss i++ i++ i {
				if (ss.equals(t)) {
					System.out.println(0);
					return;
				} else if (ss.charAt(i) != t.charAt(i)) {
					lm++;
				}
			} {
				if (ss.equals(t)) {
					System.out.println(0);
					return;
				} else if (ss.charAt(i) != t.charAt(i)) {
					lm++;
				}
			} if (ss.equals(t)) {
					System.out.println(0);
					return;
				} else if (ss.charAt(i) != t.charAt(i)) {
					lm++;
				} ss.equals(t) ss.equals ss t {
					System.out.println(0);
					return;
				} System.out.println(0) System.out.println System.out System System.out 0 return; if (ss.charAt(i) != t.charAt(i)) {
					lm++;
				} ss.charAt(i) != t.charAt(i) ss.charAt(i) ss.charAt ss i t.charAt(i) t.charAt t i {
					lm++;
				} lm++ lm gm = Math.min(gm, lm) gm Math.min(gm, lm) Math.min Math gm lm System.out.println(gm) System.out.println System.out System System.out gm String s s String t t public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		solve(S, T);
	}

	private static void solve(String s, String t) {
		// TODO Auto-generated method stub
		int n = t.length(), l = s.length();
		List<String> subs = new ArrayList<String>();
		for (int i = 0; i <= l - n; i++) {
			subs.add(s.substring(i, i + n));
		}
//		System.out.println(subs.toString());
		int gm = Integer.MAX_VALUE;
		for (String ss : subs) {
			int lm = 0;
			for (int i = 0; i < ss.length(); i++) {
				if (ss.equals(t)) {
					System.out.println(0);
					return;
				} else if (ss.charAt(i) != t.charAt(i)) {
					lm++;
				}
			}
			gm = Math.min(gm, lm);
		}
		System.out.println(gm);
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		solve(S, T);
	}

	private static void solve(String s, String t) {
		// TODO Auto-generated method stub
		int n = t.length(), l = s.length();
		List<String> subs = new ArrayList<String>();
		for (int i = 0; i <= l - n; i++) {
			subs.add(s.substring(i, i + n));
		}
//		System.out.println(subs.toString());
		int gm = Integer.MAX_VALUE;
		for (String ss : subs) {
			int lm = 0;
			for (int i = 0; i < ss.length(); i++) {
				if (ss.equals(t)) {
					System.out.println(0);
					return;
				} else if (ss.charAt(i) != t.charAt(i)) {
					lm++;
				}
			}
			gm = Math.min(gm, lm);
		}
		System.out.println(gm);
	}

} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		solve(S, T);
	}

	private static void solve(String s, String t) {
		// TODO Auto-generated method stub
		int n = t.length(), l = s.length();
		List<String> subs = new ArrayList<String>();
		for (int i = 0; i <= l - n; i++) {
			subs.add(s.substring(i, i + n));
		}
//		System.out.println(subs.toString());
		int gm = Integer.MAX_VALUE;
		for (String ss : subs) {
			int lm = 0;
			for (int i = 0; i < ss.length(); i++) {
				if (ss.equals(t)) {
					System.out.println(0);
					return;
				} else if (ss.charAt(i) != t.charAt(i)) {
					lm++;
				}
			}
			gm = Math.min(gm, lm);
		}
		System.out.println(gm);
	}

}
