import java.util.*;
public class Main
{
    public static void main(String args[])
    {
        Scanner kb = new Scanner(System.in);

        String s1 = kb.nextLine();
        String s2 = kb.nextLine();

        int k = s2.length();
        int min = Integer.MAX_VALUE;

        for(int i = k ; i <= s1.length() ; i++)
        {
            String tmp = s1.substring(i-k,i);
            int t = diff(s2,tmp);
            if(t < min)
                min = t;
        }
        System.out.println(min);

    }
    public static int diff(String s1,String s2)
    {
        int res = 0;

        for(int i = 0 ; i < s1.length() ; i++)
        {
            if(s1.charAt(i) != s2.charAt(i))
            {
                res++;
            }
        }
        return res;
    }
} import java.util.*; util.* java public class Main
{
    public static void main(String args[])
    {
        Scanner kb = new Scanner(System.in);

        String s1 = kb.nextLine();
        String s2 = kb.nextLine();

        int k = s2.length();
        int min = Integer.MAX_VALUE;

        for(int i = k ; i <= s1.length() ; i++)
        {
            String tmp = s1.substring(i-k,i);
            int t = diff(s2,tmp);
            if(t < min)
                min = t;
        }
        System.out.println(min);

    }
    public static int diff(String s1,String s2)
    {
        int res = 0;

        for(int i = 0 ; i < s1.length() ; i++)
        {
            if(s1.charAt(i) != s2.charAt(i))
            {
                res++;
            }
        }
        return res;
    }
} Main public static void main(String args[])
    {
        Scanner kb = new Scanner(System.in);

        String s1 = kb.nextLine();
        String s2 = kb.nextLine();

        int k = s2.length();
        int min = Integer.MAX_VALUE;

        for(int i = k ; i <= s1.length() ; i++)
        {
            String tmp = s1.substring(i-k,i);
            int t = diff(s2,tmp);
            if(t < min)
                min = t;
        }
        System.out.println(min);

    } main {
        Scanner kb = new Scanner(System.in);

        String s1 = kb.nextLine();
        String s2 = kb.nextLine();

        int k = s2.length();
        int min = Integer.MAX_VALUE;

        for(int i = k ; i <= s1.length() ; i++)
        {
            String tmp = s1.substring(i-k,i);
            int t = diff(s2,tmp);
            if(t < min)
                min = t;
        }
        System.out.println(min);

    } Scanner kb = new Scanner(System.in); kb new Scanner(System.in) String s1 = kb.nextLine(); s1 kb.nextLine() kb.nextLine kb String s2 = kb.nextLine(); s2 kb.nextLine() kb.nextLine kb int k = s2.length(); k s2.length() s2.length s2 int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i = k ; i <= s1.length() ; i++)
        {
            String tmp = s1.substring(i-k,i);
            int t = diff(s2,tmp);
            if(t < min)
                min = t;
        } int i = k ; int i = k ; i k i <= s1.length() i s1.length() s1.length s1 i++ i++ i {
            String tmp = s1.substring(i-k,i);
            int t = diff(s2,tmp);
            if(t < min)
                min = t;
        } {
            String tmp = s1.substring(i-k,i);
            int t = diff(s2,tmp);
            if(t < min)
                min = t;
        } String tmp = s1.substring(i-k,i); tmp s1.substring(i-k,i) s1.substring s1 i-k i k i int t = diff(s2,tmp); t diff(s2,tmp) diff s2 tmp if(t < min)
                min = t; t < min t min min = t min t System.out.println(min) System.out.println System.out System System.out min String args[] args public static int diff(String s1,String s2)
    {
        int res = 0;

        for(int i = 0 ; i < s1.length() ; i++)
        {
            if(s1.charAt(i) != s2.charAt(i))
            {
                res++;
            }
        }
        return res;
    } diff {
        int res = 0;

        for(int i = 0 ; i < s1.length() ; i++)
        {
            if(s1.charAt(i) != s2.charAt(i))
            {
                res++;
            }
        }
        return res;
    } int res = 0; res 0 for(int i = 0 ; i < s1.length() ; i++)
        {
            if(s1.charAt(i) != s2.charAt(i))
            {
                res++;
            }
        } int i = 0 ; int i = 0 ; i 0 i < s1.length() i s1.length() s1.length s1 i++ i++ i {
            if(s1.charAt(i) != s2.charAt(i))
            {
                res++;
            }
        } {
            if(s1.charAt(i) != s2.charAt(i))
            {
                res++;
            }
        } if(s1.charAt(i) != s2.charAt(i))
            {
                res++;
            } s1.charAt(i) != s2.charAt(i) s1.charAt(i) s1.charAt s1 i s2.charAt(i) s2.charAt s2 i {
                res++;
            } res++ res return res; res String s1 s1 String s2 s2 public class Main
{
    public static void main(String args[])
    {
        Scanner kb = new Scanner(System.in);

        String s1 = kb.nextLine();
        String s2 = kb.nextLine();

        int k = s2.length();
        int min = Integer.MAX_VALUE;

        for(int i = k ; i <= s1.length() ; i++)
        {
            String tmp = s1.substring(i-k,i);
            int t = diff(s2,tmp);
            if(t < min)
                min = t;
        }
        System.out.println(min);

    }
    public static int diff(String s1,String s2)
    {
        int res = 0;

        for(int i = 0 ; i < s1.length() ; i++)
        {
            if(s1.charAt(i) != s2.charAt(i))
            {
                res++;
            }
        }
        return res;
    }
} public class Main
{
    public static void main(String args[])
    {
        Scanner kb = new Scanner(System.in);

        String s1 = kb.nextLine();
        String s2 = kb.nextLine();

        int k = s2.length();
        int min = Integer.MAX_VALUE;

        for(int i = k ; i <= s1.length() ; i++)
        {
            String tmp = s1.substring(i-k,i);
            int t = diff(s2,tmp);
            if(t < min)
                min = t;
        }
        System.out.println(min);

    }
    public static int diff(String s1,String s2)
    {
        int res = 0;

        for(int i = 0 ; i < s1.length() ; i++)
        {
            if(s1.charAt(i) != s2.charAt(i))
            {
                res++;
            }
        }
        return res;
    }
} Main
import java.util.*;
public class Main
{
    public static void main(String args[])
    {
        Scanner kb = new Scanner(System.in);

        String s1 = kb.nextLine();
        String s2 = kb.nextLine();

        int k = s2.length();
        int min = Integer.MAX_VALUE;

        for(int i = k ; i <= s1.length() ; i++)
        {
            String tmp = s1.substring(i-k,i);
            int t = diff(s2,tmp);
            if(t < min)
                min = t;
        }
        System.out.println(min);

    }
    public static int diff(String s1,String s2)
    {
        int res = 0;

        for(int i = 0 ; i < s1.length() ; i++)
        {
            if(s1.charAt(i) != s2.charAt(i))
            {
                res++;
            }
        }
        return res;
    }
}