
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        String S = scan.next();
        String T = scan.next();

        int ans = Integer.MAX_VALUE;
        int maxPattern = S.length() - T.length() + 1;
        for(int i = 0; i < maxPattern; i++) {
            int diff = T.length();
            for(int j = 0; j < T.length(); j++) {
                if(S.charAt(i+j) == T.charAt(j))
                    diff--;
            }
            ans = Math.min(ans, diff);
        }

        os.println(ans);

    }
} import java.io.InputStream; InputStream java.io import java.io.PrintStream; PrintStream java.io import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        String S = scan.next();
        String T = scan.next();

        int ans = Integer.MAX_VALUE;
        int maxPattern = S.length() - T.length() + 1;
        for(int i = 0; i < maxPattern; i++) {
            int diff = T.length();
            for(int j = 0; j < T.length(); j++) {
                if(S.charAt(i+j) == T.charAt(j))
                    diff--;
            }
            ans = Math.min(ans, diff);
        }

        os.println(ans);

    }
} Main public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    } main {
        solve(System.in, System.out);
    } solve(System.in, System.out) solve System.in System System.in System.out System System.out String[] args args static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        String S = scan.next();
        String T = scan.next();

        int ans = Integer.MAX_VALUE;
        int maxPattern = S.length() - T.length() + 1;
        for(int i = 0; i < maxPattern; i++) {
            int diff = T.length();
            for(int j = 0; j < T.length(); j++) {
                if(S.charAt(i+j) == T.charAt(j))
                    diff--;
            }
            ans = Math.min(ans, diff);
        }

        os.println(ans);

    } solve {
        // Your code here!
        Scanner scan = new Scanner(is);
        String S = scan.next();
        String T = scan.next();

        int ans = Integer.MAX_VALUE;
        int maxPattern = S.length() - T.length() + 1;
        for(int i = 0; i < maxPattern; i++) {
            int diff = T.length();
            for(int j = 0; j < T.length(); j++) {
                if(S.charAt(i+j) == T.charAt(j))
                    diff--;
            }
            ans = Math.min(ans, diff);
        }

        os.println(ans);

    } Scanner scan = new Scanner(is); scan new Scanner(is) String S = scan.next(); S scan.next() scan.next scan String T = scan.next(); T scan.next() scan.next scan int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE int maxPattern = S.length() - T.length() + 1; maxPattern S.length() - T.length() + 1 S.length() - T.length() S.length() S.length S T.length() T.length T 1 for(int i = 0; i < maxPattern; i++) {
            int diff = T.length();
            for(int j = 0; j < T.length(); j++) {
                if(S.charAt(i+j) == T.charAt(j))
                    diff--;
            }
            ans = Math.min(ans, diff);
        } int i = 0; int i = 0; i 0 i < maxPattern i maxPattern i++ i++ i {
            int diff = T.length();
            for(int j = 0; j < T.length(); j++) {
                if(S.charAt(i+j) == T.charAt(j))
                    diff--;
            }
            ans = Math.min(ans, diff);
        } {
            int diff = T.length();
            for(int j = 0; j < T.length(); j++) {
                if(S.charAt(i+j) == T.charAt(j))
                    diff--;
            }
            ans = Math.min(ans, diff);
        } int diff = T.length(); diff T.length() T.length T for(int j = 0; j < T.length(); j++) {
                if(S.charAt(i+j) == T.charAt(j))
                    diff--;
            } 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))
                    diff--;
            } {
                if(S.charAt(i+j) == T.charAt(j))
                    diff--;
            } if(S.charAt(i+j) == T.charAt(j))
                    diff--; 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 diff-- diff ans = Math.min(ans, diff) ans Math.min(ans, diff) Math.min Math ans diff os.println(ans) os.println os ans InputStream is is PrintStream os os public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        String S = scan.next();
        String T = scan.next();

        int ans = Integer.MAX_VALUE;
        int maxPattern = S.length() - T.length() + 1;
        for(int i = 0; i < maxPattern; i++) {
            int diff = T.length();
            for(int j = 0; j < T.length(); j++) {
                if(S.charAt(i+j) == T.charAt(j))
                    diff--;
            }
            ans = Math.min(ans, diff);
        }

        os.println(ans);

    }
} public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        String S = scan.next();
        String T = scan.next();

        int ans = Integer.MAX_VALUE;
        int maxPattern = S.length() - T.length() + 1;
        for(int i = 0; i < maxPattern; i++) {
            int diff = T.length();
            for(int j = 0; j < T.length(); j++) {
                if(S.charAt(i+j) == T.charAt(j))
                    diff--;
            }
            ans = Math.min(ans, diff);
        }

        os.println(ans);

    }
} Main

import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        String S = scan.next();
        String T = scan.next();

        int ans = Integer.MAX_VALUE;
        int maxPattern = S.length() - T.length() + 1;
        for(int i = 0; i < maxPattern; i++) {
            int diff = T.length();
            for(int j = 0; j < T.length(); j++) {
                if(S.charAt(i+j) == T.charAt(j))
                    diff--;
            }
            ans = Math.min(ans, diff);
        }

        os.println(ans);

    }
}