import 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 max = 0;
        for (int i = 0;i < S.length()-T.length()+1 ; i++){
             int cnt = 0;
            String test = S.substring(i,i+T.length());
            for (int ind = 0; ind<T.length();ind++){
                if (test.charAt(ind)==T.charAt(ind)){
                    cnt++;
                }
            }
            if (max<cnt){
                max=cnt;
            }
        }
        System.out.println(T.length()-max);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int max = 0;
        for (int i = 0;i < S.length()-T.length()+1 ; i++){
             int cnt = 0;
            String test = S.substring(i,i+T.length());
            for (int ind = 0; ind<T.length();ind++){
                if (test.charAt(ind)==T.charAt(ind)){
                    cnt++;
                }
            }
            if (max<cnt){
                max=cnt;
            }
        }
        System.out.println(T.length()-max);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int max = 0;
        for (int i = 0;i < S.length()-T.length()+1 ; i++){
             int cnt = 0;
            String test = S.substring(i,i+T.length());
            for (int ind = 0; ind<T.length();ind++){
                if (test.charAt(ind)==T.charAt(ind)){
                    cnt++;
                }
            }
            if (max<cnt){
                max=cnt;
            }
        }
        System.out.println(T.length()-max);
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int max = 0;
        for (int i = 0;i < S.length()-T.length()+1 ; i++){
             int cnt = 0;
            String test = S.substring(i,i+T.length());
            for (int ind = 0; ind<T.length();ind++){
                if (test.charAt(ind)==T.charAt(ind)){
                    cnt++;
                }
            }
            if (max<cnt){
                max=cnt;
            }
        }
        System.out.println(T.length()-max);
    } 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 max = 0; max 0 for (int i = 0;i < S.length()-T.length()+1 ; i++){
             int cnt = 0;
            String test = S.substring(i,i+T.length());
            for (int ind = 0; ind<T.length();ind++){
                if (test.charAt(ind)==T.charAt(ind)){
                    cnt++;
                }
            }
            if (max<cnt){
                max=cnt;
            }
        } 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 cnt = 0;
            String test = S.substring(i,i+T.length());
            for (int ind = 0; ind<T.length();ind++){
                if (test.charAt(ind)==T.charAt(ind)){
                    cnt++;
                }
            }
            if (max<cnt){
                max=cnt;
            }
        } {
             int cnt = 0;
            String test = S.substring(i,i+T.length());
            for (int ind = 0; ind<T.length();ind++){
                if (test.charAt(ind)==T.charAt(ind)){
                    cnt++;
                }
            }
            if (max<cnt){
                max=cnt;
            }
        } int cnt = 0; cnt 0 String test = S.substring(i,i+T.length()); test S.substring(i,i+T.length()) S.substring S i i+T.length() i T.length() T.length T for (int ind = 0; ind<T.length();ind++){
                if (test.charAt(ind)==T.charAt(ind)){
                    cnt++;
                }
            } int ind = 0; int ind = 0; ind 0 ind<T.length() ind T.length() T.length T ind++ ind++ ind {
                if (test.charAt(ind)==T.charAt(ind)){
                    cnt++;
                }
            } {
                if (test.charAt(ind)==T.charAt(ind)){
                    cnt++;
                }
            } if (test.charAt(ind)==T.charAt(ind)){
                    cnt++;
                } test.charAt(ind)==T.charAt(ind) test.charAt(ind) test.charAt test ind T.charAt(ind) T.charAt T ind {
                    cnt++;
                } cnt++ cnt if (max<cnt){
                max=cnt;
            } max<cnt max cnt {
                max=cnt;
            } max=cnt max cnt System.out.println(T.length()-max) System.out.println System.out System System.out T.length()-max T.length() T.length T max 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 max = 0;
        for (int i = 0;i < S.length()-T.length()+1 ; i++){
             int cnt = 0;
            String test = S.substring(i,i+T.length());
            for (int ind = 0; ind<T.length();ind++){
                if (test.charAt(ind)==T.charAt(ind)){
                    cnt++;
                }
            }
            if (max<cnt){
                max=cnt;
            }
        }
        System.out.println(T.length()-max);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int max = 0;
        for (int i = 0;i < S.length()-T.length()+1 ; i++){
             int cnt = 0;
            String test = S.substring(i,i+T.length());
            for (int ind = 0; ind<T.length();ind++){
                if (test.charAt(ind)==T.charAt(ind)){
                    cnt++;
                }
            }
            if (max<cnt){
                max=cnt;
            }
        }
        System.out.println(T.length()-max);
    }
} Main
import 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 max = 0;
        for (int i = 0;i < S.length()-T.length()+1 ; i++){
             int cnt = 0;
            String test = S.substring(i,i+T.length());
            for (int ind = 0; ind<T.length();ind++){
                if (test.charAt(ind)==T.charAt(ind)){
                    cnt++;
                }
            }
            if (max<cnt){
                max=cnt;
            }
        }
        System.out.println(T.length()-max);
    }
}