import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        String S = buffer.readLine();
        String T = buffer.readLine();
        int  minLen = Integer.MAX_VALUE;
        for (int pos = 0; pos < S.length()-T.length()+1; pos++) {
            int currLen = 0;
            for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i)!=S.charAt(pos+i))currLen++;
            }
            minLen = Math.min(minLen, currLen);
        }
        System.out.println(minLen);
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        String S = buffer.readLine();
        String T = buffer.readLine();
        int  minLen = Integer.MAX_VALUE;
        for (int pos = 0; pos < S.length()-T.length()+1; pos++) {
            int currLen = 0;
            for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i)!=S.charAt(pos+i))currLen++;
            }
            minLen = Math.min(minLen, currLen);
        }
        System.out.println(minLen);
    }
} Main public static void main(String[] args) throws Exception {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        String S = buffer.readLine();
        String T = buffer.readLine();
        int  minLen = Integer.MAX_VALUE;
        for (int pos = 0; pos < S.length()-T.length()+1; pos++) {
            int currLen = 0;
            for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i)!=S.charAt(pos+i))currLen++;
            }
            minLen = Math.min(minLen, currLen);
        }
        System.out.println(minLen);
    } main {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        String S = buffer.readLine();
        String T = buffer.readLine();
        int  minLen = Integer.MAX_VALUE;
        for (int pos = 0; pos < S.length()-T.length()+1; pos++) {
            int currLen = 0;
            for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i)!=S.charAt(pos+i))currLen++;
            }
            minLen = Math.min(minLen, currLen);
        }
        System.out.println(minLen);
    } BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in)); buffer new BufferedReader(new InputStreamReader(System.in)) String S = buffer.readLine(); S buffer.readLine() buffer.readLine buffer String T = buffer.readLine(); T buffer.readLine() buffer.readLine buffer int  minLen = Integer.MAX_VALUE; minLen Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int pos = 0; pos < S.length()-T.length()+1; pos++) {
            int currLen = 0;
            for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i)!=S.charAt(pos+i))currLen++;
            }
            minLen = Math.min(minLen, currLen);
        } int pos = 0; int pos = 0; pos 0 pos < S.length()-T.length()+1 pos S.length()-T.length()+1 S.length()-T.length() S.length() S.length S T.length() T.length T 1 pos++ pos++ pos {
            int currLen = 0;
            for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i)!=S.charAt(pos+i))currLen++;
            }
            minLen = Math.min(minLen, currLen);
        } {
            int currLen = 0;
            for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i)!=S.charAt(pos+i))currLen++;
            }
            minLen = Math.min(minLen, currLen);
        } int currLen = 0; currLen 0 for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i)!=S.charAt(pos+i))currLen++;
            } int i = 0; int i = 0; i 0 i < T.length() i T.length() T.length T i++ i++ i {
                if (T.charAt(i)!=S.charAt(pos+i))currLen++;
            } {
                if (T.charAt(i)!=S.charAt(pos+i))currLen++;
            } if (T.charAt(i)!=S.charAt(pos+i))currLen++; T.charAt(i)!=S.charAt(pos+i) T.charAt(i) T.charAt T i S.charAt(pos+i) S.charAt S pos+i pos i currLen++ currLen minLen = Math.min(minLen, currLen) minLen Math.min(minLen, currLen) Math.min Math minLen currLen System.out.println(minLen) System.out.println System.out System System.out minLen String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        String S = buffer.readLine();
        String T = buffer.readLine();
        int  minLen = Integer.MAX_VALUE;
        for (int pos = 0; pos < S.length()-T.length()+1; pos++) {
            int currLen = 0;
            for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i)!=S.charAt(pos+i))currLen++;
            }
            minLen = Math.min(minLen, currLen);
        }
        System.out.println(minLen);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        String S = buffer.readLine();
        String T = buffer.readLine();
        int  minLen = Integer.MAX_VALUE;
        for (int pos = 0; pos < S.length()-T.length()+1; pos++) {
            int currLen = 0;
            for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i)!=S.charAt(pos+i))currLen++;
            }
            minLen = Math.min(minLen, currLen);
        }
        System.out.println(minLen);
    }
} Main
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        String S = buffer.readLine();
        String T = buffer.readLine();
        int  minLen = Integer.MAX_VALUE;
        for (int pos = 0; pos < S.length()-T.length()+1; pos++) {
            int currLen = 0;
            for (int i = 0; i < T.length(); i++) {
                if (T.charAt(i)!=S.charAt(pos+i))currLen++;
            }
            minLen = Math.min(minLen, currLen);
        }
        System.out.println(minLen);
    }
}
