import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();

		int ans = t.length();

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

		System.out.println(ans);


	}

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

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();

		int ans = t.length();

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

		System.out.println(ans);


	}

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();

		int ans = t.length();

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

		System.out.println(ans);


	} main {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();

		int ans = t.length();

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

		System.out.println(ans);


	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan String t = scan.next(); t scan.next() scan.next scan int ans = t.length(); ans t.length() t.length t for (int i = 0; i <= s.length()-t.length(); i++) {
			int diff=0;
			for (int j = 0; j < t.length(); j++) {
				if(s.charAt(i+j) != t.charAt(j) ) {
					diff++;
				}
			}
			ans = Math.min(ans,diff);
		} int i = 0; int i = 0; i 0 i <= s.length()-t.length() i s.length()-t.length() s.length() s.length s t.length() t.length t i++ i++ i {
			int diff=0;
			for (int j = 0; j < t.length(); j++) {
				if(s.charAt(i+j) != t.charAt(j) ) {
					diff++;
				}
			}
			ans = Math.min(ans,diff);
		} {
			int diff=0;
			for (int j = 0; j < t.length(); j++) {
				if(s.charAt(i+j) != t.charAt(j) ) {
					diff++;
				}
			}
			ans = Math.min(ans,diff);
		} int diff=0; diff 0 for (int j = 0; j < t.length(); j++) {
				if(s.charAt(i+j) != t.charAt(j) ) {
					diff++;
				}
			} 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) ) {
					diff++;
				}
			} {
				if(s.charAt(i+j) != t.charAt(j) ) {
					diff++;
				}
			} if(s.charAt(i+j) != t.charAt(j) ) {
					diff++;
				} 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 {
					diff++;
				} diff++ diff ans = Math.min(ans,diff) ans Math.min(ans,diff) Math.min Math 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 scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();

		int ans = t.length();

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

		System.out.println(ans);


	}

} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();

		int ans = t.length();

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

		System.out.println(ans);


	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();

		int ans = t.length();

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

		System.out.println(ans);


	}

}