import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) {
        FastScanner in = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        char s[] = in.next().toCharArray();
        char t[] = in.next().toCharArray();
        int n = s.length, m = t.length;
        int min = Integer.MAX_VALUE;
        for(int i=0;i<=n-m;i++) {
        	int cnt = 0;
        	for(int j=0;j<m;j++) {
        		if(t[j]==s[j+i]) continue;
        		else {
        			cnt++;
        		}
        	}
        	min = Math.min(min, cnt);
        }
        out.println(min);
        out.flush();
	}
	
	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		
		String next() {
			while(!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				}catch(IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		int[] readArray(int n) {
			int a[] = new int[n];
			for(int i=0;i<n;i++) a[i] = nextInt();
			return a;
		}
		
		long[] readArray(int n,long x) {
			long a[] = new long[n];
			for(int i=0;i<n;i++) a[i] = nextLong();
			return a;
		}
		
	}
	
	static boolean arrayEquals(char a[], char b[]) {
		int n = a.length;
		boolean verdict = true;
		for(int i=0;i<n;i++) {
			if(a[i]!=b[i]) {
				verdict = false;break;
			}
		}
		return verdict;
	}
	
	static long lcm(long a, long b) {
		return (a*b)/gcd(a,b);
	}
	
	static long gcd(long a, long b) {
		if(b==0) return a;
		else return gcd(b,a%b);
	}
}






 import java.io.*; io.* java import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
        FastScanner in = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        char s[] = in.next().toCharArray();
        char t[] = in.next().toCharArray();
        int n = s.length, m = t.length;
        int min = Integer.MAX_VALUE;
        for(int i=0;i<=n-m;i++) {
        	int cnt = 0;
        	for(int j=0;j<m;j++) {
        		if(t[j]==s[j+i]) continue;
        		else {
        			cnt++;
        		}
        	}
        	min = Math.min(min, cnt);
        }
        out.println(min);
        out.flush();
	}
	
	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		
		String next() {
			while(!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				}catch(IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		int[] readArray(int n) {
			int a[] = new int[n];
			for(int i=0;i<n;i++) a[i] = nextInt();
			return a;
		}
		
		long[] readArray(int n,long x) {
			long a[] = new long[n];
			for(int i=0;i<n;i++) a[i] = nextLong();
			return a;
		}
		
	}
	
	static boolean arrayEquals(char a[], char b[]) {
		int n = a.length;
		boolean verdict = true;
		for(int i=0;i<n;i++) {
			if(a[i]!=b[i]) {
				verdict = false;break;
			}
		}
		return verdict;
	}
	
	static long lcm(long a, long b) {
		return (a*b)/gcd(a,b);
	}
	
	static long gcd(long a, long b) {
		if(b==0) return a;
		else return gcd(b,a%b);
	}
} Main public static void main(String[] args) {
        FastScanner in = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        char s[] = in.next().toCharArray();
        char t[] = in.next().toCharArray();
        int n = s.length, m = t.length;
        int min = Integer.MAX_VALUE;
        for(int i=0;i<=n-m;i++) {
        	int cnt = 0;
        	for(int j=0;j<m;j++) {
        		if(t[j]==s[j+i]) continue;
        		else {
        			cnt++;
        		}
        	}
        	min = Math.min(min, cnt);
        }
        out.println(min);
        out.flush();
	} main {
        FastScanner in = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        char s[] = in.next().toCharArray();
        char t[] = in.next().toCharArray();
        int n = s.length, m = t.length;
        int min = Integer.MAX_VALUE;
        for(int i=0;i<=n-m;i++) {
        	int cnt = 0;
        	for(int j=0;j<m;j++) {
        		if(t[j]==s[j+i]) continue;
        		else {
        			cnt++;
        		}
        	}
        	min = Math.min(min, cnt);
        }
        out.println(min);
        out.flush();
	} FastScanner in = new FastScanner(); in new FastScanner() PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) char s[] = in.next().toCharArray(); s in.next().toCharArray() in.next().toCharArray in.next() in.next in char t[] = in.next().toCharArray(); t in.next().toCharArray() in.next().toCharArray in.next() in.next in int n = s.length n s.length s s.length m = t.length; m t.length t t.length int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i=0;i<=n-m;i++) {
        	int cnt = 0;
        	for(int j=0;j<m;j++) {
        		if(t[j]==s[j+i]) continue;
        		else {
        			cnt++;
        		}
        	}
        	min = Math.min(min, cnt);
        } int i=0; int i=0; i 0 i<=n-m i n-m n m i++ i++ i {
        	int cnt = 0;
        	for(int j=0;j<m;j++) {
        		if(t[j]==s[j+i]) continue;
        		else {
        			cnt++;
        		}
        	}
        	min = Math.min(min, cnt);
        } {
        	int cnt = 0;
        	for(int j=0;j<m;j++) {
        		if(t[j]==s[j+i]) continue;
        		else {
        			cnt++;
        		}
        	}
        	min = Math.min(min, cnt);
        } int cnt = 0; cnt 0 for(int j=0;j<m;j++) {
        		if(t[j]==s[j+i]) continue;
        		else {
        			cnt++;
        		}
        	} int j=0; int j=0; j 0 j<m j m j++ j++ j {
        		if(t[j]==s[j+i]) continue;
        		else {
        			cnt++;
        		}
        	} {
        		if(t[j]==s[j+i]) continue;
        		else {
        			cnt++;
        		}
        	} if(t[j]==s[j+i]) continue;
        		else {
        			cnt++;
        		} t[j]==s[j+i] t[j] t j s[j+i] s j+i j i continue; {
        			cnt++;
        		} cnt++ cnt min = Math.min(min, cnt) min Math.min(min, cnt) Math.min Math min cnt out.println(min) out.println out min out.flush() out.flush out String[] args args static boolean arrayEquals(char a[], char b[]) {
		int n = a.length;
		boolean verdict = true;
		for(int i=0;i<n;i++) {
			if(a[i]!=b[i]) {
				verdict = false;break;
			}
		}
		return verdict;
	} arrayEquals {
		int n = a.length;
		boolean verdict = true;
		for(int i=0;i<n;i++) {
			if(a[i]!=b[i]) {
				verdict = false;break;
			}
		}
		return verdict;
	} int n = a.length; n a.length a a.length boolean verdict = true; verdict true for(int i=0;i<n;i++) {
			if(a[i]!=b[i]) {
				verdict = false;break;
			}
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			if(a[i]!=b[i]) {
				verdict = false;break;
			}
		} {
			if(a[i]!=b[i]) {
				verdict = false;break;
			}
		} if(a[i]!=b[i]) {
				verdict = false;break;
			} a[i]!=b[i] a[i] a i b[i] b i {
				verdict = false;break;
			} verdict = false verdict false break; return verdict; verdict char a[] a char b[] b static long lcm(long a, long b) {
		return (a*b)/gcd(a,b);
	} lcm {
		return (a*b)/gcd(a,b);
	} return (a*b)/gcd(a,b); (a*b)/gcd(a,b) (a*b) a b gcd(a,b) gcd a b long a a long b b static long gcd(long a, long b) {
		if(b==0) return a;
		else return gcd(b,a%b);
	} gcd {
		if(b==0) return a;
		else return gcd(b,a%b);
	} if(b==0) return a;
		else return gcd(b,a%b); b==0 b 0 return a; a return gcd(b,a%b); gcd(b,a%b) gcd b a%b a b long a a long b b static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		
		String next() {
			while(!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				}catch(IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		int[] readArray(int n) {
			int a[] = new int[n];
			for(int i=0;i<n;i++) a[i] = nextInt();
			return a;
		}
		
		long[] readArray(int n,long x) {
			long a[] = new long[n];
			for(int i=0;i<n;i++) a[i] = nextLong();
			return a;
		}
		
	} FastScanner BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st = new StringTokenizer(""); st new StringTokenizer("") String next() {
			while(!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				}catch(IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		} next {
			while(!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				}catch(IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		} while(!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				}catch(IOException e) {
					e.printStackTrace();
				} !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st try {
					st = new StringTokenizer(br.readLine());
				}catch(IOException e) {
					e.printStackTrace();
				} catch(IOException e) {
					e.printStackTrace();
				} IOException e {
					e.printStackTrace();
				} e.printStackTrace() e.printStackTrace e {
					st = new StringTokenizer(br.readLine());
				} st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int nextInt() {
			return Integer.parseInt(next());
		} nextInt {
			return Integer.parseInt(next());
		} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nextLong() {
			return Long.parseLong(next());
		} nextLong {
			return Long.parseLong(next());
		} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next int[] readArray(int n) {
			int a[] = new int[n];
			for(int i=0;i<n;i++) a[i] = nextInt();
			return a;
		} readArray {
			int a[] = new int[n];
			for(int i=0;i<n;i++) a[i] = nextInt();
			return a;
		} int a[] = new int[n]; a new int[n] n for(int i=0;i<n;i++) a[i] = nextInt(); int i=0; int i=0; i 0 i<n i n i++ i++ i a[i] = nextInt(); a[i] = nextInt() a[i] a i nextInt() nextInt return a; a int n n long[] readArray(int n,long x) {
			long a[] = new long[n];
			for(int i=0;i<n;i++) a[i] = nextLong();
			return a;
		} readArray {
			long a[] = new long[n];
			for(int i=0;i<n;i++) a[i] = nextLong();
			return a;
		} long a[] = new long[n]; a new long[n] n for(int i=0;i<n;i++) a[i] = nextLong(); int i=0; int i=0; i 0 i<n i n i++ i++ i a[i] = nextLong(); a[i] = nextLong() a[i] a i nextLong() nextLong return a; a int n n long x x public class Main {

	public static void main(String[] args) {
        FastScanner in = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        char s[] = in.next().toCharArray();
        char t[] = in.next().toCharArray();
        int n = s.length, m = t.length;
        int min = Integer.MAX_VALUE;
        for(int i=0;i<=n-m;i++) {
        	int cnt = 0;
        	for(int j=0;j<m;j++) {
        		if(t[j]==s[j+i]) continue;
        		else {
        			cnt++;
        		}
        	}
        	min = Math.min(min, cnt);
        }
        out.println(min);
        out.flush();
	}
	
	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		
		String next() {
			while(!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				}catch(IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		int[] readArray(int n) {
			int a[] = new int[n];
			for(int i=0;i<n;i++) a[i] = nextInt();
			return a;
		}
		
		long[] readArray(int n,long x) {
			long a[] = new long[n];
			for(int i=0;i<n;i++) a[i] = nextLong();
			return a;
		}
		
	}
	
	static boolean arrayEquals(char a[], char b[]) {
		int n = a.length;
		boolean verdict = true;
		for(int i=0;i<n;i++) {
			if(a[i]!=b[i]) {
				verdict = false;break;
			}
		}
		return verdict;
	}
	
	static long lcm(long a, long b) {
		return (a*b)/gcd(a,b);
	}
	
	static long gcd(long a, long b) {
		if(b==0) return a;
		else return gcd(b,a%b);
	}
} public class Main {

	public static void main(String[] args) {
        FastScanner in = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        char s[] = in.next().toCharArray();
        char t[] = in.next().toCharArray();
        int n = s.length, m = t.length;
        int min = Integer.MAX_VALUE;
        for(int i=0;i<=n-m;i++) {
        	int cnt = 0;
        	for(int j=0;j<m;j++) {
        		if(t[j]==s[j+i]) continue;
        		else {
        			cnt++;
        		}
        	}
        	min = Math.min(min, cnt);
        }
        out.println(min);
        out.flush();
	}
	
	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		
		String next() {
			while(!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				}catch(IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		int[] readArray(int n) {
			int a[] = new int[n];
			for(int i=0;i<n;i++) a[i] = nextInt();
			return a;
		}
		
		long[] readArray(int n,long x) {
			long a[] = new long[n];
			for(int i=0;i<n;i++) a[i] = nextLong();
			return a;
		}
		
	}
	
	static boolean arrayEquals(char a[], char b[]) {
		int n = a.length;
		boolean verdict = true;
		for(int i=0;i<n;i++) {
			if(a[i]!=b[i]) {
				verdict = false;break;
			}
		}
		return verdict;
	}
	
	static long lcm(long a, long b) {
		return (a*b)/gcd(a,b);
	}
	
	static long gcd(long a, long b) {
		if(b==0) return a;
		else return gcd(b,a%b);
	}
} Main
import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) {
        FastScanner in = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        char s[] = in.next().toCharArray();
        char t[] = in.next().toCharArray();
        int n = s.length, m = t.length;
        int min = Integer.MAX_VALUE;
        for(int i=0;i<=n-m;i++) {
        	int cnt = 0;
        	for(int j=0;j<m;j++) {
        		if(t[j]==s[j+i]) continue;
        		else {
        			cnt++;
        		}
        	}
        	min = Math.min(min, cnt);
        }
        out.println(min);
        out.flush();
	}
	
	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		
		String next() {
			while(!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				}catch(IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		int[] readArray(int n) {
			int a[] = new int[n];
			for(int i=0;i<n;i++) a[i] = nextInt();
			return a;
		}
		
		long[] readArray(int n,long x) {
			long a[] = new long[n];
			for(int i=0;i<n;i++) a[i] = nextLong();
			return a;
		}
		
	}
	
	static boolean arrayEquals(char a[], char b[]) {
		int n = a.length;
		boolean verdict = true;
		for(int i=0;i<n;i++) {
			if(a[i]!=b[i]) {
				verdict = false;break;
			}
		}
		return verdict;
	}
	
	static long lcm(long a, long b) {
		return (a*b)/gcd(a,b);
	}
	
	static long gcd(long a, long b) {
		if(b==0) return a;
		else return gcd(b,a%b);
	}
}







