import java.util.Scanner;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		try {
		    Scanner sc = new Scanner(System.in);
		    String s,t;
		    int c,m,i,j;
		    s=sc.nextLine();
		    t=sc.nextLine();
		    m=2147483647;
		    c=0;
		    for(i=0;i<=(s.length()-t.length());i++)
		    {
		        c=0;
		      for(j=i;j<(i+t.length());j++)
		        {
		        if(s.charAt(j)!=t.charAt(j-i))
		          c++;
		        }
		       
		       if(c<m)
		        m=c;
		    }
		    System.out.println(m);
		    
		} catch(Exception e) {
		}
	}
} import java.util.Scanner; Scanner java.util public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		try {
		    Scanner sc = new Scanner(System.in);
		    String s,t;
		    int c,m,i,j;
		    s=sc.nextLine();
		    t=sc.nextLine();
		    m=2147483647;
		    c=0;
		    for(i=0;i<=(s.length()-t.length());i++)
		    {
		        c=0;
		      for(j=i;j<(i+t.length());j++)
		        {
		        if(s.charAt(j)!=t.charAt(j-i))
		          c++;
		        }
		       
		       if(c<m)
		        m=c;
		    }
		    System.out.println(m);
		    
		} catch(Exception e) {
		}
	}
} Main public static void main (String[] args) throws java.lang.Exception
	{
		try {
		    Scanner sc = new Scanner(System.in);
		    String s,t;
		    int c,m,i,j;
		    s=sc.nextLine();
		    t=sc.nextLine();
		    m=2147483647;
		    c=0;
		    for(i=0;i<=(s.length()-t.length());i++)
		    {
		        c=0;
		      for(j=i;j<(i+t.length());j++)
		        {
		        if(s.charAt(j)!=t.charAt(j-i))
		          c++;
		        }
		       
		       if(c<m)
		        m=c;
		    }
		    System.out.println(m);
		    
		} catch(Exception e) {
		}
	} main {
		try {
		    Scanner sc = new Scanner(System.in);
		    String s,t;
		    int c,m,i,j;
		    s=sc.nextLine();
		    t=sc.nextLine();
		    m=2147483647;
		    c=0;
		    for(i=0;i<=(s.length()-t.length());i++)
		    {
		        c=0;
		      for(j=i;j<(i+t.length());j++)
		        {
		        if(s.charAt(j)!=t.charAt(j-i))
		          c++;
		        }
		       
		       if(c<m)
		        m=c;
		    }
		    System.out.println(m);
		    
		} catch(Exception e) {
		}
	} try {
		    Scanner sc = new Scanner(System.in);
		    String s,t;
		    int c,m,i,j;
		    s=sc.nextLine();
		    t=sc.nextLine();
		    m=2147483647;
		    c=0;
		    for(i=0;i<=(s.length()-t.length());i++)
		    {
		        c=0;
		      for(j=i;j<(i+t.length());j++)
		        {
		        if(s.charAt(j)!=t.charAt(j-i))
		          c++;
		        }
		       
		       if(c<m)
		        m=c;
		    }
		    System.out.println(m);
		    
		} catch(Exception e) {
		} catch(Exception e) {
		} Exception e {
		} {
		    Scanner sc = new Scanner(System.in);
		    String s,t;
		    int c,m,i,j;
		    s=sc.nextLine();
		    t=sc.nextLine();
		    m=2147483647;
		    c=0;
		    for(i=0;i<=(s.length()-t.length());i++)
		    {
		        c=0;
		      for(j=i;j<(i+t.length());j++)
		        {
		        if(s.charAt(j)!=t.charAt(j-i))
		          c++;
		        }
		       
		       if(c<m)
		        m=c;
		    }
		    System.out.println(m);
		    
		} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s s t; t int c c m m i i j; j s=sc.nextLine() s sc.nextLine() sc.nextLine sc t=sc.nextLine() t sc.nextLine() sc.nextLine sc m=2147483647 m 2147483647 c=0 c 0 for(i=0;i<=(s.length()-t.length());i++)
		    {
		        c=0;
		      for(j=i;j<(i+t.length());j++)
		        {
		        if(s.charAt(j)!=t.charAt(j-i))
		          c++;
		        }
		       
		       if(c<m)
		        m=c;
		    } i=0; i=0 i 0 i<=(s.length()-t.length()) i (s.length()-t.length()) s.length() s.length s t.length() t.length t i++ i++ i {
		        c=0;
		      for(j=i;j<(i+t.length());j++)
		        {
		        if(s.charAt(j)!=t.charAt(j-i))
		          c++;
		        }
		       
		       if(c<m)
		        m=c;
		    } {
		        c=0;
		      for(j=i;j<(i+t.length());j++)
		        {
		        if(s.charAt(j)!=t.charAt(j-i))
		          c++;
		        }
		       
		       if(c<m)
		        m=c;
		    } c=0 c 0 for(j=i;j<(i+t.length());j++)
		        {
		        if(s.charAt(j)!=t.charAt(j-i))
		          c++;
		        } j=i; j=i j i j<(i+t.length()) j (i+t.length()) i t.length() t.length t j++ j++ j {
		        if(s.charAt(j)!=t.charAt(j-i))
		          c++;
		        } {
		        if(s.charAt(j)!=t.charAt(j-i))
		          c++;
		        } if(s.charAt(j)!=t.charAt(j-i))
		          c++; s.charAt(j)!=t.charAt(j-i) s.charAt(j) s.charAt s j t.charAt(j-i) t.charAt t j-i j i c++ c if(c<m)
		        m=c; c<m c m m=c m c System.out.println(m) System.out.println System.out System System.out m String[] args args public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		try {
		    Scanner sc = new Scanner(System.in);
		    String s,t;
		    int c,m,i,j;
		    s=sc.nextLine();
		    t=sc.nextLine();
		    m=2147483647;
		    c=0;
		    for(i=0;i<=(s.length()-t.length());i++)
		    {
		        c=0;
		      for(j=i;j<(i+t.length());j++)
		        {
		        if(s.charAt(j)!=t.charAt(j-i))
		          c++;
		        }
		       
		       if(c<m)
		        m=c;
		    }
		    System.out.println(m);
		    
		} catch(Exception e) {
		}
	}
} public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		try {
		    Scanner sc = new Scanner(System.in);
		    String s,t;
		    int c,m,i,j;
		    s=sc.nextLine();
		    t=sc.nextLine();
		    m=2147483647;
		    c=0;
		    for(i=0;i<=(s.length()-t.length());i++)
		    {
		        c=0;
		      for(j=i;j<(i+t.length());j++)
		        {
		        if(s.charAt(j)!=t.charAt(j-i))
		          c++;
		        }
		       
		       if(c<m)
		        m=c;
		    }
		    System.out.println(m);
		    
		} catch(Exception e) {
		}
	}
} Main
import java.util.Scanner;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		try {
		    Scanner sc = new Scanner(System.in);
		    String s,t;
		    int c,m,i,j;
		    s=sc.nextLine();
		    t=sc.nextLine();
		    m=2147483647;
		    c=0;
		    for(i=0;i<=(s.length()-t.length());i++)
		    {
		        c=0;
		      for(j=i;j<(i+t.length());j++)
		        {
		        if(s.charAt(j)!=t.charAt(j-i))
		          c++;
		        }
		       
		       if(c<m)
		        m=c;
		    }
		    System.out.println(m);
		    
		} catch(Exception e) {
		}
	}
}
