import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        String S = sc.next();
        String T = sc.next();
        int min = INF;
        for(int i=0;i<S.length()-T.length()+1;i++){
            int cnt = 0;
            for(int j=0;j<T.length();j++){
                if(S.charAt(i+j)!=T.charAt(j))cnt++;
            }
            min = Math.min(min,cnt);
        }
        System.out.println(min);
    }

    public static void main(String[] args) {
        new Main();
    }
} import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util import java.util.Comparator; Comparator java.util import java.util.HashMap; HashMap java.util import java.util.HashSet; HashSet java.util import java.util.Iterator; Iterator java.util import java.util.List; List java.util import java.util.Map.Entry; Entry java.util.Map import java.util.PriorityQueue; PriorityQueue java.util import java.util.Scanner; Scanner java.util class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        String S = sc.next();
        String T = sc.next();
        int min = INF;
        for(int i=0;i<S.length()-T.length()+1;i++){
            int cnt = 0;
            for(int j=0;j<T.length();j++){
                if(S.charAt(i+j)!=T.charAt(j))cnt++;
            }
            min = Math.min(min,cnt);
        }
        System.out.println(min);
    }

    public static void main(String[] args) {
        new Main();
    }
} Main static final int MOD = 1000000007; MOD 1000000007 static final int INF = 1 << 30; INF 1 << 30 1 30 static final int ALF = 26; ALF 26 Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        String S = sc.next();
        String T = sc.next();
        int min = INF;
        for(int i=0;i<S.length()-T.length()+1;i++){
            int cnt = 0;
            for(int j=0;j<T.length();j++){
                if(S.charAt(i+j)!=T.charAt(j))cnt++;
            }
            min = Math.min(min,cnt);
        }
        System.out.println(min);
    } Main {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        String S = sc.next();
        String T = sc.next();
        int min = INF;
        for(int i=0;i<S.length()-T.length()+1;i++){
            int cnt = 0;
            for(int j=0;j<T.length();j++){
                if(S.charAt(i+j)!=T.charAt(j))cnt++;
            }
            min = Math.min(min,cnt);
        }
        System.out.println(min);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long ans = 0; ans 0 String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc int min = INF; min INF for(int i=0;i<S.length()-T.length()+1;i++){
            int cnt = 0;
            for(int j=0;j<T.length();j++){
                if(S.charAt(i+j)!=T.charAt(j))cnt++;
            }
            min = Math.min(min,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;
            for(int j=0;j<T.length();j++){
                if(S.charAt(i+j)!=T.charAt(j))cnt++;
            }
            min = Math.min(min,cnt);
        } {
            int cnt = 0;
            for(int j=0;j<T.length();j++){
                if(S.charAt(i+j)!=T.charAt(j))cnt++;
            }
            min = Math.min(min,cnt);
        } int cnt = 0; cnt 0 for(int j=0;j<T.length();j++){
                if(S.charAt(i+j)!=T.charAt(j))cnt++;
            } int j=0; int j=0; j 0 j<T.length() j T.length() T.length T j++ j++ j {
                if(S.charAt(i+j)!=T.charAt(j))cnt++;
            } {
                if(S.charAt(i+j)!=T.charAt(j))cnt++;
            } if(S.charAt(i+j)!=T.charAt(j))cnt++; S.charAt(i+j)!=T.charAt(j) S.charAt(i+j) S.charAt S i+j i j T.charAt(j) T.charAt T j cnt++ cnt min = Math.min(min,cnt) min Math.min(min,cnt) Math.min Math min cnt System.out.println(min) System.out.println System.out System System.out min public static void main(String[] args) {
        new Main();
    } main {
        new Main();
    } new Main() String[] args args
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        String S = sc.next();
        String T = sc.next();
        int min = INF;
        for(int i=0;i<S.length()-T.length()+1;i++){
            int cnt = 0;
            for(int j=0;j<T.length();j++){
                if(S.charAt(i+j)!=T.charAt(j))cnt++;
            }
            min = Math.min(min,cnt);
        }
        System.out.println(min);
    }

    public static void main(String[] args) {
        new Main();
    }
}
