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

public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc=new Scanner(System.in);
		Reader reader=new Reader();
		int t=1;//sc.nextInt();
		while(t-->0) {
			String s1=reader.next();
			int n=s1.length();
			String s2=reader.next();
			int len=s2.length();
			int min=Integer.MAX_VALUE;
			for(int i=0;i<n-len+1;i++) {
				String temp=s1.substring(i,i+len);
				int count=0;
				for(int j=0;j<temp.length();j++) {
					if(temp.charAt(j)!=s2.charAt(j)) count++;
				}
				min=Math.min(count, min);
			}
			System.out.println(min);
		}
	}
}
class Reader{
	BufferedReader reader;
	Reader(){
		reader=new BufferedReader(new InputStreamReader(System.in));
	}
	int nextInt() throws IOException{
		String in=reader.readLine().trim();
		return Integer.parseInt(in);
	}
	long nextLong() throws IOException{
		String in=reader.readLine().trim();
		return Long.parseLong(in);
	}
	String next() throws IOException{
		return reader.readLine().trim();
	}
	String[] stringArray() throws IOException{
		return reader.readLine().trim().split("\\s+");
	}
	int[] intArray() throws IOException{
		String[] inp=this.stringArray();
		int[] arr=new int[inp.length];
		int i=0;
		for(String s:inp) {
			arr[i++]=Integer.parseInt(s);
		}
		return arr;
	}
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc=new Scanner(System.in);
		Reader reader=new Reader();
		int t=1;//sc.nextInt();
		while(t-->0) {
			String s1=reader.next();
			int n=s1.length();
			String s2=reader.next();
			int len=s2.length();
			int min=Integer.MAX_VALUE;
			for(int i=0;i<n-len+1;i++) {
				String temp=s1.substring(i,i+len);
				int count=0;
				for(int j=0;j<temp.length();j++) {
					if(temp.charAt(j)!=s2.charAt(j)) count++;
				}
				min=Math.min(count, min);
			}
			System.out.println(min);
		}
	}
} Main public static void main(String[] args) throws IOException{
		Scanner sc=new Scanner(System.in);
		Reader reader=new Reader();
		int t=1;//sc.nextInt();
		while(t-->0) {
			String s1=reader.next();
			int n=s1.length();
			String s2=reader.next();
			int len=s2.length();
			int min=Integer.MAX_VALUE;
			for(int i=0;i<n-len+1;i++) {
				String temp=s1.substring(i,i+len);
				int count=0;
				for(int j=0;j<temp.length();j++) {
					if(temp.charAt(j)!=s2.charAt(j)) count++;
				}
				min=Math.min(count, min);
			}
			System.out.println(min);
		}
	} main {
		Scanner sc=new Scanner(System.in);
		Reader reader=new Reader();
		int t=1;//sc.nextInt();
		while(t-->0) {
			String s1=reader.next();
			int n=s1.length();
			String s2=reader.next();
			int len=s2.length();
			int min=Integer.MAX_VALUE;
			for(int i=0;i<n-len+1;i++) {
				String temp=s1.substring(i,i+len);
				int count=0;
				for(int j=0;j<temp.length();j++) {
					if(temp.charAt(j)!=s2.charAt(j)) count++;
				}
				min=Math.min(count, min);
			}
			System.out.println(min);
		}
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) Reader reader=new Reader(); reader new Reader() int t=1; t 1 while(t-->0) {
			String s1=reader.next();
			int n=s1.length();
			String s2=reader.next();
			int len=s2.length();
			int min=Integer.MAX_VALUE;
			for(int i=0;i<n-len+1;i++) {
				String temp=s1.substring(i,i+len);
				int count=0;
				for(int j=0;j<temp.length();j++) {
					if(temp.charAt(j)!=s2.charAt(j)) count++;
				}
				min=Math.min(count, min);
			}
			System.out.println(min);
		} t-->0 t-- t 0 {
			String s1=reader.next();
			int n=s1.length();
			String s2=reader.next();
			int len=s2.length();
			int min=Integer.MAX_VALUE;
			for(int i=0;i<n-len+1;i++) {
				String temp=s1.substring(i,i+len);
				int count=0;
				for(int j=0;j<temp.length();j++) {
					if(temp.charAt(j)!=s2.charAt(j)) count++;
				}
				min=Math.min(count, min);
			}
			System.out.println(min);
		} String s1=reader.next(); s1 reader.next() reader.next reader int n=s1.length(); n s1.length() s1.length s1 String s2=reader.next(); s2 reader.next() reader.next reader int len=s2.length(); len s2.length() s2.length s2 int min=Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i=0;i<n-len+1;i++) {
				String temp=s1.substring(i,i+len);
				int count=0;
				for(int j=0;j<temp.length();j++) {
					if(temp.charAt(j)!=s2.charAt(j)) count++;
				}
				min=Math.min(count, min);
			} int i=0; int i=0; i 0 i<n-len+1 i n-len+1 n-len n len 1 i++ i++ i {
				String temp=s1.substring(i,i+len);
				int count=0;
				for(int j=0;j<temp.length();j++) {
					if(temp.charAt(j)!=s2.charAt(j)) count++;
				}
				min=Math.min(count, min);
			} {
				String temp=s1.substring(i,i+len);
				int count=0;
				for(int j=0;j<temp.length();j++) {
					if(temp.charAt(j)!=s2.charAt(j)) count++;
				}
				min=Math.min(count, min);
			} String temp=s1.substring(i,i+len); temp s1.substring(i,i+len) s1.substring s1 i i+len i len int count=0; count 0 for(int j=0;j<temp.length();j++) {
					if(temp.charAt(j)!=s2.charAt(j)) count++;
				} int j=0; int j=0; j 0 j<temp.length() j temp.length() temp.length temp j++ j++ j {
					if(temp.charAt(j)!=s2.charAt(j)) count++;
				} {
					if(temp.charAt(j)!=s2.charAt(j)) count++;
				} if(temp.charAt(j)!=s2.charAt(j)) count++; temp.charAt(j)!=s2.charAt(j) temp.charAt(j) temp.charAt temp j s2.charAt(j) s2.charAt s2 j count++ count min=Math.min(count, min) min Math.min(count, min) Math.min Math count min System.out.println(min) System.out.println System.out System System.out min String[] args args class Reader{
	BufferedReader reader;
	Reader(){
		reader=new BufferedReader(new InputStreamReader(System.in));
	}
	int nextInt() throws IOException{
		String in=reader.readLine().trim();
		return Integer.parseInt(in);
	}
	long nextLong() throws IOException{
		String in=reader.readLine().trim();
		return Long.parseLong(in);
	}
	String next() throws IOException{
		return reader.readLine().trim();
	}
	String[] stringArray() throws IOException{
		return reader.readLine().trim().split("\\s+");
	}
	int[] intArray() throws IOException{
		String[] inp=this.stringArray();
		int[] arr=new int[inp.length];
		int i=0;
		for(String s:inp) {
			arr[i++]=Integer.parseInt(s);
		}
		return arr;
	}
} Reader BufferedReader reader; reader Reader(){
		reader=new BufferedReader(new InputStreamReader(System.in));
	} Reader {
		reader=new BufferedReader(new InputStreamReader(System.in));
	} reader=new BufferedReader(new InputStreamReader(System.in)) reader new BufferedReader(new InputStreamReader(System.in)) int nextInt() throws IOException{
		String in=reader.readLine().trim();
		return Integer.parseInt(in);
	} nextInt {
		String in=reader.readLine().trim();
		return Integer.parseInt(in);
	} String in=reader.readLine().trim(); in reader.readLine().trim() reader.readLine().trim reader.readLine() reader.readLine reader return Integer.parseInt(in); Integer.parseInt(in) Integer.parseInt Integer in long nextLong() throws IOException{
		String in=reader.readLine().trim();
		return Long.parseLong(in);
	} nextLong {
		String in=reader.readLine().trim();
		return Long.parseLong(in);
	} String in=reader.readLine().trim(); in reader.readLine().trim() reader.readLine().trim reader.readLine() reader.readLine reader return Long.parseLong(in); Long.parseLong(in) Long.parseLong Long in String next() throws IOException{
		return reader.readLine().trim();
	} next {
		return reader.readLine().trim();
	} return reader.readLine().trim(); reader.readLine().trim() reader.readLine().trim reader.readLine() reader.readLine reader String[] stringArray() throws IOException{
		return reader.readLine().trim().split("\\s+");
	} stringArray {
		return reader.readLine().trim().split("\\s+");
	} return reader.readLine().trim().split("\\s+"); reader.readLine().trim().split("\\s+") reader.readLine().trim().split reader.readLine().trim() reader.readLine().trim reader.readLine() reader.readLine reader "\\s+" int[] intArray() throws IOException{
		String[] inp=this.stringArray();
		int[] arr=new int[inp.length];
		int i=0;
		for(String s:inp) {
			arr[i++]=Integer.parseInt(s);
		}
		return arr;
	} intArray {
		String[] inp=this.stringArray();
		int[] arr=new int[inp.length];
		int i=0;
		for(String s:inp) {
			arr[i++]=Integer.parseInt(s);
		}
		return arr;
	} String[] inp=this.stringArray(); inp this.stringArray() this.stringArray this int[] arr=new int[inp.length]; arr new int[inp.length] inp.length inp inp.length int i=0; i 0 for(String s:inp) {
			arr[i++]=Integer.parseInt(s);
		} String s inp {
			arr[i++]=Integer.parseInt(s);
		} {
			arr[i++]=Integer.parseInt(s);
		} arr[i++]=Integer.parseInt(s) arr[i++] arr i++ i Integer.parseInt(s) Integer.parseInt Integer s return arr; arr public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc=new Scanner(System.in);
		Reader reader=new Reader();
		int t=1;//sc.nextInt();
		while(t-->0) {
			String s1=reader.next();
			int n=s1.length();
			String s2=reader.next();
			int len=s2.length();
			int min=Integer.MAX_VALUE;
			for(int i=0;i<n-len+1;i++) {
				String temp=s1.substring(i,i+len);
				int count=0;
				for(int j=0;j<temp.length();j++) {
					if(temp.charAt(j)!=s2.charAt(j)) count++;
				}
				min=Math.min(count, min);
			}
			System.out.println(min);
		}
	}
} public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc=new Scanner(System.in);
		Reader reader=new Reader();
		int t=1;//sc.nextInt();
		while(t-->0) {
			String s1=reader.next();
			int n=s1.length();
			String s2=reader.next();
			int len=s2.length();
			int min=Integer.MAX_VALUE;
			for(int i=0;i<n-len+1;i++) {
				String temp=s1.substring(i,i+len);
				int count=0;
				for(int j=0;j<temp.length();j++) {
					if(temp.charAt(j)!=s2.charAt(j)) count++;
				}
				min=Math.min(count, min);
			}
			System.out.println(min);
		}
	}
} Main
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc=new Scanner(System.in);
		Reader reader=new Reader();
		int t=1;//sc.nextInt();
		while(t-->0) {
			String s1=reader.next();
			int n=s1.length();
			String s2=reader.next();
			int len=s2.length();
			int min=Integer.MAX_VALUE;
			for(int i=0;i<n-len+1;i++) {
				String temp=s1.substring(i,i+len);
				int count=0;
				for(int j=0;j<temp.length();j++) {
					if(temp.charAt(j)!=s2.charAt(j)) count++;
				}
				min=Math.min(count, min);
			}
			System.out.println(min);
		}
	}
}
class Reader{
	BufferedReader reader;
	Reader(){
		reader=new BufferedReader(new InputStreamReader(System.in));
	}
	int nextInt() throws IOException{
		String in=reader.readLine().trim();
		return Integer.parseInt(in);
	}
	long nextLong() throws IOException{
		String in=reader.readLine().trim();
		return Long.parseLong(in);
	}
	String next() throws IOException{
		return reader.readLine().trim();
	}
	String[] stringArray() throws IOException{
		return reader.readLine().trim().split("\\s+");
	}
	int[] intArray() throws IOException{
		String[] inp=this.stringArray();
		int[] arr=new int[inp.length];
		int i=0;
		for(String s:inp) {
			arr[i++]=Integer.parseInt(s);
		}
		return arr;
	}
}
