import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);

        String s = stdIn.nextLine();
        String t = stdIn.nextLine();
        int c = 0;
        int x = t.length();
        for(int i = 0 ; i < (s.length() - t.length()) + 1 ; i++){
            for(int j = 0 ; j < t.length() ; j++){
                if(t.charAt(j) != s.charAt(i + j)){
                    c += 1;
                }
            }
            if(x > c){
                x = c;
            }
            c = 0;
        }
        System.out.println(x);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);

        String s = stdIn.nextLine();
        String t = stdIn.nextLine();
        int c = 0;
        int x = t.length();
        for(int i = 0 ; i < (s.length() - t.length()) + 1 ; i++){
            for(int j = 0 ; j < t.length() ; j++){
                if(t.charAt(j) != s.charAt(i + j)){
                    c += 1;
                }
            }
            if(x > c){
                x = c;
            }
            c = 0;
        }
        System.out.println(x);
    }
} Main public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);

        String s = stdIn.nextLine();
        String t = stdIn.nextLine();
        int c = 0;
        int x = t.length();
        for(int i = 0 ; i < (s.length() - t.length()) + 1 ; i++){
            for(int j = 0 ; j < t.length() ; j++){
                if(t.charAt(j) != s.charAt(i + j)){
                    c += 1;
                }
            }
            if(x > c){
                x = c;
            }
            c = 0;
        }
        System.out.println(x);
    } main {
        Scanner stdIn = new Scanner(System.in);

        String s = stdIn.nextLine();
        String t = stdIn.nextLine();
        int c = 0;
        int x = t.length();
        for(int i = 0 ; i < (s.length() - t.length()) + 1 ; i++){
            for(int j = 0 ; j < t.length() ; j++){
                if(t.charAt(j) != s.charAt(i + j)){
                    c += 1;
                }
            }
            if(x > c){
                x = c;
            }
            c = 0;
        }
        System.out.println(x);
    } Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) String s = stdIn.nextLine(); s stdIn.nextLine() stdIn.nextLine stdIn String t = stdIn.nextLine(); t stdIn.nextLine() stdIn.nextLine stdIn int c = 0; c 0 int x = t.length(); x t.length() t.length t for(int i = 0 ; i < (s.length() - t.length()) + 1 ; i++){
            for(int j = 0 ; j < t.length() ; j++){
                if(t.charAt(j) != s.charAt(i + j)){
                    c += 1;
                }
            }
            if(x > c){
                x = c;
            }
            c = 0;
        } 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 {
            for(int j = 0 ; j < t.length() ; j++){
                if(t.charAt(j) != s.charAt(i + j)){
                    c += 1;
                }
            }
            if(x > c){
                x = c;
            }
            c = 0;
        } {
            for(int j = 0 ; j < t.length() ; j++){
                if(t.charAt(j) != s.charAt(i + j)){
                    c += 1;
                }
            }
            if(x > c){
                x = c;
            }
            c = 0;
        } for(int j = 0 ; j < t.length() ; j++){
                if(t.charAt(j) != s.charAt(i + j)){
                    c += 1;
                }
            } int j = 0 ; int j = 0 ; j 0 j < t.length() j t.length() t.length t j++ j++ j {
                if(t.charAt(j) != s.charAt(i + j)){
                    c += 1;
                }
            } {
                if(t.charAt(j) != s.charAt(i + j)){
                    c += 1;
                }
            } if(t.charAt(j) != s.charAt(i + j)){
                    c += 1;
                } t.charAt(j) != s.charAt(i + j) t.charAt(j) t.charAt t j s.charAt(i + j) s.charAt s i + j i j {
                    c += 1;
                } c += 1 c 1 if(x > c){
                x = c;
            } x > c x c {
                x = c;
            } x = c x c c = 0 c 0 System.out.println(x) System.out.println System.out System System.out x String[] args args public class Main {
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);

        String s = stdIn.nextLine();
        String t = stdIn.nextLine();
        int c = 0;
        int x = t.length();
        for(int i = 0 ; i < (s.length() - t.length()) + 1 ; i++){
            for(int j = 0 ; j < t.length() ; j++){
                if(t.charAt(j) != s.charAt(i + j)){
                    c += 1;
                }
            }
            if(x > c){
                x = c;
            }
            c = 0;
        }
        System.out.println(x);
    }
} public class Main {
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);

        String s = stdIn.nextLine();
        String t = stdIn.nextLine();
        int c = 0;
        int x = t.length();
        for(int i = 0 ; i < (s.length() - t.length()) + 1 ; i++){
            for(int j = 0 ; j < t.length() ; j++){
                if(t.charAt(j) != s.charAt(i + j)){
                    c += 1;
                }
            }
            if(x > c){
                x = c;
            }
            c = 0;
        }
        System.out.println(x);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);

        String s = stdIn.nextLine();
        String t = stdIn.nextLine();
        int c = 0;
        int x = t.length();
        for(int i = 0 ; i < (s.length() - t.length()) + 1 ; i++){
            for(int j = 0 ; j < t.length() ; j++){
                if(t.charAt(j) != s.charAt(i + j)){
                    c += 1;
                }
            }
            if(x > c){
                x = c;
            }
            c = 0;
        }
        System.out.println(x);
    }
}
