import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        //long start = System.currentTimeMillis();
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        sc.close();

        int min = t.length();

        for (int i = 0;i<s.length() - t.length() + 1;++i)
        {
            int count = t.length();
            String tmp = s.substring(i,i+t.length());
            System.err.println(tmp);
            for (int j = 0;j<t.length();++j)
            {
                String ss = tmp.substring(j,j+1);
                String tt = t.substring(j,j+1);
                if (ss.equals(tt)) --count;
            }

            if (min > count) min = count;
        }
        System.out.println(min);

//        long end = System.currentTimeMillis();
//        System.err.println((end-start)+"ms");
    }
} import java.util.*; util.* java public class Main
{
    public static void main(String[] args)
    {
        //long start = System.currentTimeMillis();
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        sc.close();

        int min = t.length();

        for (int i = 0;i<s.length() - t.length() + 1;++i)
        {
            int count = t.length();
            String tmp = s.substring(i,i+t.length());
            System.err.println(tmp);
            for (int j = 0;j<t.length();++j)
            {
                String ss = tmp.substring(j,j+1);
                String tt = t.substring(j,j+1);
                if (ss.equals(tt)) --count;
            }

            if (min > count) min = count;
        }
        System.out.println(min);

//        long end = System.currentTimeMillis();
//        System.err.println((end-start)+"ms");
    }
} Main public static void main(String[] args)
    {
        //long start = System.currentTimeMillis();
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        sc.close();

        int min = t.length();

        for (int i = 0;i<s.length() - t.length() + 1;++i)
        {
            int count = t.length();
            String tmp = s.substring(i,i+t.length());
            System.err.println(tmp);
            for (int j = 0;j<t.length();++j)
            {
                String ss = tmp.substring(j,j+1);
                String tt = t.substring(j,j+1);
                if (ss.equals(tt)) --count;
            }

            if (min > count) min = count;
        }
        System.out.println(min);

//        long end = System.currentTimeMillis();
//        System.err.println((end-start)+"ms");
    } main {
        //long start = System.currentTimeMillis();
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        sc.close();

        int min = t.length();

        for (int i = 0;i<s.length() - t.length() + 1;++i)
        {
            int count = t.length();
            String tmp = s.substring(i,i+t.length());
            System.err.println(tmp);
            for (int j = 0;j<t.length();++j)
            {
                String ss = tmp.substring(j,j+1);
                String tt = t.substring(j,j+1);
                if (ss.equals(tt)) --count;
            }

            if (min > count) min = count;
        }
        System.out.println(min);

//        long end = System.currentTimeMillis();
//        System.err.println((end-start)+"ms");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc sc.close() sc.close sc int min = t.length(); min t.length() t.length t for (int i = 0;i<s.length() - t.length() + 1;++i)
        {
            int count = t.length();
            String tmp = s.substring(i,i+t.length());
            System.err.println(tmp);
            for (int j = 0;j<t.length();++j)
            {
                String ss = tmp.substring(j,j+1);
                String tt = t.substring(j,j+1);
                if (ss.equals(tt)) --count;
            }

            if (min > count) min = count;
        } int i = 0; int i = 0; i 0 i<s.length() - t.length() + 1 i s.length() - t.length() + 1 s.length() - t.length() s.length() s.length s t.length() t.length t 1 ++i ++i i {
            int count = t.length();
            String tmp = s.substring(i,i+t.length());
            System.err.println(tmp);
            for (int j = 0;j<t.length();++j)
            {
                String ss = tmp.substring(j,j+1);
                String tt = t.substring(j,j+1);
                if (ss.equals(tt)) --count;
            }

            if (min > count) min = count;
        } {
            int count = t.length();
            String tmp = s.substring(i,i+t.length());
            System.err.println(tmp);
            for (int j = 0;j<t.length();++j)
            {
                String ss = tmp.substring(j,j+1);
                String tt = t.substring(j,j+1);
                if (ss.equals(tt)) --count;
            }

            if (min > count) min = count;
        } int count = t.length(); count t.length() t.length t String tmp = s.substring(i,i+t.length()); tmp s.substring(i,i+t.length()) s.substring s i i+t.length() i t.length() t.length t System.err.println(tmp) System.err.println System.err System System.err tmp for (int j = 0;j<t.length();++j)
            {
                String ss = tmp.substring(j,j+1);
                String tt = t.substring(j,j+1);
                if (ss.equals(tt)) --count;
            } int j = 0; int j = 0; j 0 j<t.length() j t.length() t.length t ++j ++j j {
                String ss = tmp.substring(j,j+1);
                String tt = t.substring(j,j+1);
                if (ss.equals(tt)) --count;
            } {
                String ss = tmp.substring(j,j+1);
                String tt = t.substring(j,j+1);
                if (ss.equals(tt)) --count;
            } String ss = tmp.substring(j,j+1); ss tmp.substring(j,j+1) tmp.substring tmp j j+1 j 1 String tt = t.substring(j,j+1); tt t.substring(j,j+1) t.substring t j j+1 j 1 if (ss.equals(tt)) --count; ss.equals(tt) ss.equals ss tt --count count if (min > count) min = count; min > count min count min = count min count 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)
    {
        //long start = System.currentTimeMillis();
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        sc.close();

        int min = t.length();

        for (int i = 0;i<s.length() - t.length() + 1;++i)
        {
            int count = t.length();
            String tmp = s.substring(i,i+t.length());
            System.err.println(tmp);
            for (int j = 0;j<t.length();++j)
            {
                String ss = tmp.substring(j,j+1);
                String tt = t.substring(j,j+1);
                if (ss.equals(tt)) --count;
            }

            if (min > count) min = count;
        }
        System.out.println(min);

//        long end = System.currentTimeMillis();
//        System.err.println((end-start)+"ms");
    }
} public class Main
{
    public static void main(String[] args)
    {
        //long start = System.currentTimeMillis();
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        sc.close();

        int min = t.length();

        for (int i = 0;i<s.length() - t.length() + 1;++i)
        {
            int count = t.length();
            String tmp = s.substring(i,i+t.length());
            System.err.println(tmp);
            for (int j = 0;j<t.length();++j)
            {
                String ss = tmp.substring(j,j+1);
                String tt = t.substring(j,j+1);
                if (ss.equals(tt)) --count;
            }

            if (min > count) min = count;
        }
        System.out.println(min);

//        long end = System.currentTimeMillis();
//        System.err.println((end-start)+"ms");
    }
} Main
import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        //long start = System.currentTimeMillis();
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        sc.close();

        int min = t.length();

        for (int i = 0;i<s.length() - t.length() + 1;++i)
        {
            int count = t.length();
            String tmp = s.substring(i,i+t.length());
            System.err.println(tmp);
            for (int j = 0;j<t.length();++j)
            {
                String ss = tmp.substring(j,j+1);
                String tt = t.substring(j,j+1);
                if (ss.equals(tt)) --count;
            }

            if (min > count) min = count;
        }
        System.out.println(min);

//        long end = System.currentTimeMillis();
//        System.err.println((end-start)+"ms");
    }
}