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

public class Main {
	public static void main(String[] args)
    {
		Scanner sc=new Scanner(System.in);
			String s1=sc.next();
			int n1=s1.length();
			String s2=sc.next();
			int n2=s2.length();
			int min=Integer.MAX_VALUE;
			for(int i=0;i<n1-n2+1;i++) {
				String temp=s1.substring(i,i+n2);
				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);
	}
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
	public static void main(String[] args)
    {
		Scanner sc=new Scanner(System.in);
			String s1=sc.next();
			int n1=s1.length();
			String s2=sc.next();
			int n2=s2.length();
			int min=Integer.MAX_VALUE;
			for(int i=0;i<n1-n2+1;i++) {
				String temp=s1.substring(i,i+n2);
				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)
    {
		Scanner sc=new Scanner(System.in);
			String s1=sc.next();
			int n1=s1.length();
			String s2=sc.next();
			int n2=s2.length();
			int min=Integer.MAX_VALUE;
			for(int i=0;i<n1-n2+1;i++) {
				String temp=s1.substring(i,i+n2);
				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);
			String s1=sc.next();
			int n1=s1.length();
			String s2=sc.next();
			int n2=s2.length();
			int min=Integer.MAX_VALUE;
			for(int i=0;i<n1-n2+1;i++) {
				String temp=s1.substring(i,i+n2);
				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) String s1=sc.next(); s1 sc.next() sc.next sc int n1=s1.length(); n1 s1.length() s1.length s1 String s2=sc.next(); s2 sc.next() sc.next sc int n2=s2.length(); n2 s2.length() s2.length s2 int min=Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i=0;i<n1-n2+1;i++) {
				String temp=s1.substring(i,i+n2);
				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<n1-n2+1 i n1-n2+1 n1-n2 n1 n2 1 i++ i++ i {
				String temp=s1.substring(i,i+n2);
				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+n2);
				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+n2); temp s1.substring(i,i+n2) s1.substring s1 i i+n2 i n2 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 public class Main {
	public static void main(String[] args)
    {
		Scanner sc=new Scanner(System.in);
			String s1=sc.next();
			int n1=s1.length();
			String s2=sc.next();
			int n2=s2.length();
			int min=Integer.MAX_VALUE;
			for(int i=0;i<n1-n2+1;i++) {
				String temp=s1.substring(i,i+n2);
				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)
    {
		Scanner sc=new Scanner(System.in);
			String s1=sc.next();
			int n1=s1.length();
			String s2=sc.next();
			int n2=s2.length();
			int min=Integer.MAX_VALUE;
			for(int i=0;i<n1-n2+1;i++) {
				String temp=s1.substring(i,i+n2);
				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)
    {
		Scanner sc=new Scanner(System.in);
			String s1=sc.next();
			int n1=s1.length();
			String s2=sc.next();
			int n2=s2.length();
			int min=Integer.MAX_VALUE;
			for(int i=0;i<n1-n2+1;i++) {
				String temp=s1.substring(i,i+n2);
				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);
	}
}
