

import java.util.Scanner;

public class Main {

	private static Scanner in;

	public static void main(String[] args) {
		in = new Scanner(System.in);
		
		String s = in.next();
		String t = in.next();
		
		int n = s.length();
		int m = t.length();
		
		int ans = Integer.MAX_VALUE;
		
		for(int i=0; i<n; i++) {
			if (i+m-1>=n) break;
			int diff = 0;
			for(int j=0; j<m; j++) {
				if (t.charAt(j)!=s.charAt(i+j)) diff++;
			}
			ans = Math.min(ans, diff);
		}
		
		System.out.println(ans);
		
		

	}

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

	private static Scanner in;

	public static void main(String[] args) {
		in = new Scanner(System.in);
		
		String s = in.next();
		String t = in.next();
		
		int n = s.length();
		int m = t.length();
		
		int ans = Integer.MAX_VALUE;
		
		for(int i=0; i<n; i++) {
			if (i+m-1>=n) break;
			int diff = 0;
			for(int j=0; j<m; j++) {
				if (t.charAt(j)!=s.charAt(i+j)) diff++;
			}
			ans = Math.min(ans, diff);
		}
		
		System.out.println(ans);
		
		

	}

} Main private static Scanner in; in public static void main(String[] args) {
		in = new Scanner(System.in);
		
		String s = in.next();
		String t = in.next();
		
		int n = s.length();
		int m = t.length();
		
		int ans = Integer.MAX_VALUE;
		
		for(int i=0; i<n; i++) {
			if (i+m-1>=n) break;
			int diff = 0;
			for(int j=0; j<m; j++) {
				if (t.charAt(j)!=s.charAt(i+j)) diff++;
			}
			ans = Math.min(ans, diff);
		}
		
		System.out.println(ans);
		
		

	} main {
		in = new Scanner(System.in);
		
		String s = in.next();
		String t = in.next();
		
		int n = s.length();
		int m = t.length();
		
		int ans = Integer.MAX_VALUE;
		
		for(int i=0; i<n; i++) {
			if (i+m-1>=n) break;
			int diff = 0;
			for(int j=0; j<m; j++) {
				if (t.charAt(j)!=s.charAt(i+j)) diff++;
			}
			ans = Math.min(ans, diff);
		}
		
		System.out.println(ans);
		
		

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

	private static Scanner in;

	public static void main(String[] args) {
		in = new Scanner(System.in);
		
		String s = in.next();
		String t = in.next();
		
		int n = s.length();
		int m = t.length();
		
		int ans = Integer.MAX_VALUE;
		
		for(int i=0; i<n; i++) {
			if (i+m-1>=n) break;
			int diff = 0;
			for(int j=0; j<m; j++) {
				if (t.charAt(j)!=s.charAt(i+j)) diff++;
			}
			ans = Math.min(ans, diff);
		}
		
		System.out.println(ans);
		
		

	}

} public class Main {

	private static Scanner in;

	public static void main(String[] args) {
		in = new Scanner(System.in);
		
		String s = in.next();
		String t = in.next();
		
		int n = s.length();
		int m = t.length();
		
		int ans = Integer.MAX_VALUE;
		
		for(int i=0; i<n; i++) {
			if (i+m-1>=n) break;
			int diff = 0;
			for(int j=0; j<m; j++) {
				if (t.charAt(j)!=s.charAt(i+j)) diff++;
			}
			ans = Math.min(ans, diff);
		}
		
		System.out.println(ans);
		
		

	}

} Main


import java.util.Scanner;

public class Main {

	private static Scanner in;

	public static void main(String[] args) {
		in = new Scanner(System.in);
		
		String s = in.next();
		String t = in.next();
		
		int n = s.length();
		int m = t.length();
		
		int ans = Integer.MAX_VALUE;
		
		for(int i=0; i<n; i++) {
			if (i+m-1>=n) break;
			int diff = 0;
			for(int j=0; j<m; j++) {
				if (t.charAt(j)!=s.charAt(i+j)) diff++;
			}
			ans = Math.min(ans, diff);
		}
		
		System.out.println(ans);
		
		

	}

}
