import java.util.Scanner;

/**
 * B - Substring
 * 2 つの文字列 S, T が与えられます。
 * T が S の部分文字列となるように、S のいくつかの文字を書き換えます。
 * 少なくとも何文字書き換える必要がありますか？
 * ただし、部分文字列とは連続する部分列のことを指します。例えば、xxx は yxxxy の部分文字列ですが、xxyxx の部分文字列ではありません。
 */
public class Main {

    public static void main( String[] args ) {

        Scanner sc = new Scanner( System.in );
        // 入力値
        String s = sc.next();
        String t = sc.next();

        int result = t.length();
        for( int i = 0; i < s.length() - ( t.length() - 1 ); i++ ) {
            int charCnt = 0;
            String subStr = s.substring( i, i + t.length() );
            if( subStr.equals( t ) ) {
                result = 0;
                break;
            }
            else {
//                char[] temp = new char[t.length()];
                for( int j = 0; j < t.length(); j++ ) {
//                    temp[j] = subStr.charAt(j);
                    if( t.charAt( j ) != subStr.charAt( j ) ) ++charCnt;
                }
            }
            if( result > charCnt ) result = charCnt;
        }

        System.out.println( result );

        sc.close();
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main( String[] args ) {

        Scanner sc = new Scanner( System.in );
        // 入力値
        String s = sc.next();
        String t = sc.next();

        int result = t.length();
        for( int i = 0; i < s.length() - ( t.length() - 1 ); i++ ) {
            int charCnt = 0;
            String subStr = s.substring( i, i + t.length() );
            if( subStr.equals( t ) ) {
                result = 0;
                break;
            }
            else {
//                char[] temp = new char[t.length()];
                for( int j = 0; j < t.length(); j++ ) {
//                    temp[j] = subStr.charAt(j);
                    if( t.charAt( j ) != subStr.charAt( j ) ) ++charCnt;
                }
            }
            if( result > charCnt ) result = charCnt;
        }

        System.out.println( result );

        sc.close();
    }
} Main public static void main( String[] args ) {

        Scanner sc = new Scanner( System.in );
        // 入力値
        String s = sc.next();
        String t = sc.next();

        int result = t.length();
        for( int i = 0; i < s.length() - ( t.length() - 1 ); i++ ) {
            int charCnt = 0;
            String subStr = s.substring( i, i + t.length() );
            if( subStr.equals( t ) ) {
                result = 0;
                break;
            }
            else {
//                char[] temp = new char[t.length()];
                for( int j = 0; j < t.length(); j++ ) {
//                    temp[j] = subStr.charAt(j);
                    if( t.charAt( j ) != subStr.charAt( j ) ) ++charCnt;
                }
            }
            if( result > charCnt ) result = charCnt;
        }

        System.out.println( result );

        sc.close();
    } main {

        Scanner sc = new Scanner( System.in );
        // 入力値
        String s = sc.next();
        String t = sc.next();

        int result = t.length();
        for( int i = 0; i < s.length() - ( t.length() - 1 ); i++ ) {
            int charCnt = 0;
            String subStr = s.substring( i, i + t.length() );
            if( subStr.equals( t ) ) {
                result = 0;
                break;
            }
            else {
//                char[] temp = new char[t.length()];
                for( int j = 0; j < t.length(); j++ ) {
//                    temp[j] = subStr.charAt(j);
                    if( t.charAt( j ) != subStr.charAt( j ) ) ++charCnt;
                }
            }
            if( result > charCnt ) result = charCnt;
        }

        System.out.println( result );

        sc.close();
    } 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 int result = t.length(); result t.length() t.length t for( int i = 0; i < s.length() - ( t.length() - 1 ); i++ ) {
            int charCnt = 0;
            String subStr = s.substring( i, i + t.length() );
            if( subStr.equals( t ) ) {
                result = 0;
                break;
            }
            else {
//                char[] temp = new char[t.length()];
                for( int j = 0; j < t.length(); j++ ) {
//                    temp[j] = subStr.charAt(j);
                    if( t.charAt( j ) != subStr.charAt( j ) ) ++charCnt;
                }
            }
            if( result > charCnt ) result = charCnt;
        } int i = 0; int i = 0; i 0 i < s.length() - ( t.length() - 1 ) i s.length() - ( t.length() - 1 ) s.length() s.length s ( t.length() - 1 ) t.length() t.length t 1 i++ i++ i {
            int charCnt = 0;
            String subStr = s.substring( i, i + t.length() );
            if( subStr.equals( t ) ) {
                result = 0;
                break;
            }
            else {
//                char[] temp = new char[t.length()];
                for( int j = 0; j < t.length(); j++ ) {
//                    temp[j] = subStr.charAt(j);
                    if( t.charAt( j ) != subStr.charAt( j ) ) ++charCnt;
                }
            }
            if( result > charCnt ) result = charCnt;
        } {
            int charCnt = 0;
            String subStr = s.substring( i, i + t.length() );
            if( subStr.equals( t ) ) {
                result = 0;
                break;
            }
            else {
//                char[] temp = new char[t.length()];
                for( int j = 0; j < t.length(); j++ ) {
//                    temp[j] = subStr.charAt(j);
                    if( t.charAt( j ) != subStr.charAt( j ) ) ++charCnt;
                }
            }
            if( result > charCnt ) result = charCnt;
        } int charCnt = 0; charCnt 0 String subStr = s.substring( i, i + t.length() ); subStr s.substring( i, i + t.length() ) s.substring s i i + t.length() i t.length() t.length t if( subStr.equals( t ) ) {
                result = 0;
                break;
            }
            else {
//                char[] temp = new char[t.length()];
                for( int j = 0; j < t.length(); j++ ) {
//                    temp[j] = subStr.charAt(j);
                    if( t.charAt( j ) != subStr.charAt( j ) ) ++charCnt;
                }
            } subStr.equals( t ) subStr.equals subStr t {
                result = 0;
                break;
            } result = 0 result 0 break; {
//                char[] temp = new char[t.length()];
                for( int j = 0; j < t.length(); j++ ) {
//                    temp[j] = subStr.charAt(j);
                    if( t.charAt( j ) != subStr.charAt( j ) ) ++charCnt;
                }
            } for( int j = 0; j < t.length(); j++ ) {
//                    temp[j] = subStr.charAt(j);
                    if( t.charAt( j ) != subStr.charAt( j ) ) ++charCnt;
                } int j = 0; int j = 0; j 0 j < t.length() j t.length() t.length t j++ j++ j {
//                    temp[j] = subStr.charAt(j);
                    if( t.charAt( j ) != subStr.charAt( j ) ) ++charCnt;
                } {
//                    temp[j] = subStr.charAt(j);
                    if( t.charAt( j ) != subStr.charAt( j ) ) ++charCnt;
                } if( t.charAt( j ) != subStr.charAt( j ) ) ++charCnt; t.charAt( j ) != subStr.charAt( j ) t.charAt( j ) t.charAt t j subStr.charAt( j ) subStr.charAt subStr j ++charCnt charCnt if( result > charCnt ) result = charCnt; result > charCnt result charCnt result = charCnt result charCnt System.out.println( result ) System.out.println System.out System System.out result sc.close() sc.close sc String[] args args public class Main {

    public static void main( String[] args ) {

        Scanner sc = new Scanner( System.in );
        // 入力値
        String s = sc.next();
        String t = sc.next();

        int result = t.length();
        for( int i = 0; i < s.length() - ( t.length() - 1 ); i++ ) {
            int charCnt = 0;
            String subStr = s.substring( i, i + t.length() );
            if( subStr.equals( t ) ) {
                result = 0;
                break;
            }
            else {
//                char[] temp = new char[t.length()];
                for( int j = 0; j < t.length(); j++ ) {
//                    temp[j] = subStr.charAt(j);
                    if( t.charAt( j ) != subStr.charAt( j ) ) ++charCnt;
                }
            }
            if( result > charCnt ) result = charCnt;
        }

        System.out.println( result );

        sc.close();
    }
} public class Main {

    public static void main( String[] args ) {

        Scanner sc = new Scanner( System.in );
        // 入力値
        String s = sc.next();
        String t = sc.next();

        int result = t.length();
        for( int i = 0; i < s.length() - ( t.length() - 1 ); i++ ) {
            int charCnt = 0;
            String subStr = s.substring( i, i + t.length() );
            if( subStr.equals( t ) ) {
                result = 0;
                break;
            }
            else {
//                char[] temp = new char[t.length()];
                for( int j = 0; j < t.length(); j++ ) {
//                    temp[j] = subStr.charAt(j);
                    if( t.charAt( j ) != subStr.charAt( j ) ) ++charCnt;
                }
            }
            if( result > charCnt ) result = charCnt;
        }

        System.out.println( result );

        sc.close();
    }
} Main
import java.util.Scanner;

/**
 * B - Substring
 * 2 つの文字列 S, T が与えられます。
 * T が S の部分文字列となるように、S のいくつかの文字を書き換えます。
 * 少なくとも何文字書き換える必要がありますか？
 * ただし、部分文字列とは連続する部分列のことを指します。例えば、xxx は yxxxy の部分文字列ですが、xxyxx の部分文字列ではありません。
 */
public class Main {

    public static void main( String[] args ) {

        Scanner sc = new Scanner( System.in );
        // 入力値
        String s = sc.next();
        String t = sc.next();

        int result = t.length();
        for( int i = 0; i < s.length() - ( t.length() - 1 ); i++ ) {
            int charCnt = 0;
            String subStr = s.substring( i, i + t.length() );
            if( subStr.equals( t ) ) {
                result = 0;
                break;
            }
            else {
//                char[] temp = new char[t.length()];
                for( int j = 0; j < t.length(); j++ ) {
//                    temp[j] = subStr.charAt(j);
                    if( t.charAt( j ) != subStr.charAt( j ) ) ++charCnt;
                }
            }
            if( result > charCnt ) result = charCnt;
        }

        System.out.println( result );

        sc.close();
    }
}
