import java.io.*;
import java.util.*;
class Main
{
	public static void main(String args[]) throws IOException
	{
		try{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		char a[]=br.readLine().toCharArray();
		char b[]=br.readLine().toCharArray();
		int ans=Integer.MAX_VALUE;int cou=0;int ind=0;
		for(int i=0;i<a.length-b.length+1;i++)
		{
			//System.out.print(a[i]+",");
			for(int j=i;j<i+b.length;j++)
			{
				if(b[ind++]!=a[j])
				{
					cou+=1;
				}
			}
			//System.out.println(cou);
			ans=Math.min(cou,ans);
			ind=0;cou=0;
		}
		System.out.println(ans);
	}
	catch(Exception e){}
}} import java.io.*; io.* java import java.util.*; util.* java class Main
{
	public static void main(String args[]) throws IOException
	{
		try{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		char a[]=br.readLine().toCharArray();
		char b[]=br.readLine().toCharArray();
		int ans=Integer.MAX_VALUE;int cou=0;int ind=0;
		for(int i=0;i<a.length-b.length+1;i++)
		{
			//System.out.print(a[i]+",");
			for(int j=i;j<i+b.length;j++)
			{
				if(b[ind++]!=a[j])
				{
					cou+=1;
				}
			}
			//System.out.println(cou);
			ans=Math.min(cou,ans);
			ind=0;cou=0;
		}
		System.out.println(ans);
	}
	catch(Exception e){}
}} Main public static void main(String args[]) throws IOException
	{
		try{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		char a[]=br.readLine().toCharArray();
		char b[]=br.readLine().toCharArray();
		int ans=Integer.MAX_VALUE;int cou=0;int ind=0;
		for(int i=0;i<a.length-b.length+1;i++)
		{
			//System.out.print(a[i]+",");
			for(int j=i;j<i+b.length;j++)
			{
				if(b[ind++]!=a[j])
				{
					cou+=1;
				}
			}
			//System.out.println(cou);
			ans=Math.min(cou,ans);
			ind=0;cou=0;
		}
		System.out.println(ans);
	}
	catch(Exception e){}
} main {
		try{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		char a[]=br.readLine().toCharArray();
		char b[]=br.readLine().toCharArray();
		int ans=Integer.MAX_VALUE;int cou=0;int ind=0;
		for(int i=0;i<a.length-b.length+1;i++)
		{
			//System.out.print(a[i]+",");
			for(int j=i;j<i+b.length;j++)
			{
				if(b[ind++]!=a[j])
				{
					cou+=1;
				}
			}
			//System.out.println(cou);
			ans=Math.min(cou,ans);
			ind=0;cou=0;
		}
		System.out.println(ans);
	}
	catch(Exception e){}
} try{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		char a[]=br.readLine().toCharArray();
		char b[]=br.readLine().toCharArray();
		int ans=Integer.MAX_VALUE;int cou=0;int ind=0;
		for(int i=0;i<a.length-b.length+1;i++)
		{
			//System.out.print(a[i]+",");
			for(int j=i;j<i+b.length;j++)
			{
				if(b[ind++]!=a[j])
				{
					cou+=1;
				}
			}
			//System.out.println(cou);
			ans=Math.min(cou,ans);
			ind=0;cou=0;
		}
		System.out.println(ans);
	}
	catch(Exception e){} catch(Exception e){} Exception e {} {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		char a[]=br.readLine().toCharArray();
		char b[]=br.readLine().toCharArray();
		int ans=Integer.MAX_VALUE;int cou=0;int ind=0;
		for(int i=0;i<a.length-b.length+1;i++)
		{
			//System.out.print(a[i]+",");
			for(int j=i;j<i+b.length;j++)
			{
				if(b[ind++]!=a[j])
				{
					cou+=1;
				}
			}
			//System.out.println(cou);
			ans=Math.min(cou,ans);
			ind=0;cou=0;
		}
		System.out.println(ans);
	} BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) char a[]=br.readLine().toCharArray(); a br.readLine().toCharArray() br.readLine().toCharArray br.readLine() br.readLine br char b[]=br.readLine().toCharArray(); b br.readLine().toCharArray() br.readLine().toCharArray br.readLine() br.readLine br int ans=Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE int cou=0; cou 0 int ind=0; ind 0 for(int i=0;i<a.length-b.length+1;i++)
		{
			//System.out.print(a[i]+",");
			for(int j=i;j<i+b.length;j++)
			{
				if(b[ind++]!=a[j])
				{
					cou+=1;
				}
			}
			//System.out.println(cou);
			ans=Math.min(cou,ans);
			ind=0;cou=0;
		} int i=0; int i=0; i 0 i<a.length-b.length+1 i a.length-b.length+1 a.length-b.length a.length a a.length b.length b b.length 1 i++ i++ i {
			//System.out.print(a[i]+",");
			for(int j=i;j<i+b.length;j++)
			{
				if(b[ind++]!=a[j])
				{
					cou+=1;
				}
			}
			//System.out.println(cou);
			ans=Math.min(cou,ans);
			ind=0;cou=0;
		} {
			//System.out.print(a[i]+",");
			for(int j=i;j<i+b.length;j++)
			{
				if(b[ind++]!=a[j])
				{
					cou+=1;
				}
			}
			//System.out.println(cou);
			ans=Math.min(cou,ans);
			ind=0;cou=0;
		} for(int j=i;j<i+b.length;j++)
			{
				if(b[ind++]!=a[j])
				{
					cou+=1;
				}
			} int j=i; int j=i; j i j<i+b.length j i+b.length i b.length b b.length j++ j++ j {
				if(b[ind++]!=a[j])
				{
					cou+=1;
				}
			} {
				if(b[ind++]!=a[j])
				{
					cou+=1;
				}
			} if(b[ind++]!=a[j])
				{
					cou+=1;
				} b[ind++]!=a[j] b[ind++] b ind++ ind a[j] a j {
					cou+=1;
				} cou+=1 cou 1 ans=Math.min(cou,ans) ans Math.min(cou,ans) Math.min Math cou ans ind=0 ind 0 cou=0 cou 0 System.out.println(ans) System.out.println System.out System System.out ans String args[] args
import java.io.*;
import java.util.*;
class Main
{
	public static void main(String args[]) throws IOException
	{
		try{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		char a[]=br.readLine().toCharArray();
		char b[]=br.readLine().toCharArray();
		int ans=Integer.MAX_VALUE;int cou=0;int ind=0;
		for(int i=0;i<a.length-b.length+1;i++)
		{
			//System.out.print(a[i]+",");
			for(int j=i;j<i+b.length;j++)
			{
				if(b[ind++]!=a[j])
				{
					cou+=1;
				}
			}
			//System.out.println(cou);
			ans=Math.min(cou,ans);
			ind=0;cou=0;
		}
		System.out.println(ans);
	}
	catch(Exception e){}
}}