import java.util.Scanner;

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

    public Main() {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int min = Integer.MAX_VALUE;
        for (int i = 0; i <= S.length() - T.length(); i++) {
            int rewrite = 0;
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) != S.charAt(i + j)) rewrite++;
            }
            min = Math.min(min, rewrite);
        }
        System.out.println(min);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        new Main();
    }

    public Main() {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int min = Integer.MAX_VALUE;
        for (int i = 0; i <= S.length() - T.length(); i++) {
            int rewrite = 0;
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) != S.charAt(i + j)) rewrite++;
            }
            min = Math.min(min, rewrite);
        }
        System.out.println(min);
    }
} Main public static void main(String[] args) {
        new Main();
    } main {
        new Main();
    } new Main() String[] args args public Main() {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int min = Integer.MAX_VALUE;
        for (int i = 0; i <= S.length() - T.length(); i++) {
            int rewrite = 0;
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) != S.charAt(i + j)) rewrite++;
            }
            min = Math.min(min, rewrite);
        }
        System.out.println(min);
    } Main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int min = Integer.MAX_VALUE;
        for (int i = 0; i <= S.length() - T.length(); i++) {
            int rewrite = 0;
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) != S.charAt(i + j)) rewrite++;
            }
            min = Math.min(min, rewrite);
        }
        System.out.println(min);
    } 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 min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = 0; i <= S.length() - T.length(); i++) {
            int rewrite = 0;
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) != S.charAt(i + j)) rewrite++;
            }
            min = Math.min(min, rewrite);
        } int i = 0; int i = 0; i 0 i <= S.length() - T.length() i S.length() - T.length() S.length() S.length S T.length() T.length T i++ i++ i {
            int rewrite = 0;
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) != S.charAt(i + j)) rewrite++;
            }
            min = Math.min(min, rewrite);
        } {
            int rewrite = 0;
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) != S.charAt(i + j)) rewrite++;
            }
            min = Math.min(min, rewrite);
        } int rewrite = 0; rewrite 0 for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) != S.charAt(i + j)) rewrite++;
            } 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)) rewrite++;
            } {
                if (T.charAt(j) != S.charAt(i + j)) rewrite++;
            } if (T.charAt(j) != S.charAt(i + j)) rewrite++; 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 rewrite++ rewrite min = Math.min(min, rewrite) min Math.min(min, rewrite) Math.min Math min rewrite System.out.println(min) System.out.println System.out System System.out min public class Main {
    public static void main(String[] args) {
        new Main();
    }

    public Main() {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int min = Integer.MAX_VALUE;
        for (int i = 0; i <= S.length() - T.length(); i++) {
            int rewrite = 0;
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) != S.charAt(i + j)) rewrite++;
            }
            min = Math.min(min, rewrite);
        }
        System.out.println(min);
    }
} public class Main {
    public static void main(String[] args) {
        new Main();
    }

    public Main() {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int min = Integer.MAX_VALUE;
        for (int i = 0; i <= S.length() - T.length(); i++) {
            int rewrite = 0;
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) != S.charAt(i + j)) rewrite++;
            }
            min = Math.min(min, rewrite);
        }
        System.out.println(min);
    }
} Main
import java.util.Scanner;

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

    public Main() {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int min = Integer.MAX_VALUE;
        for (int i = 0; i <= S.length() - T.length(); i++) {
            int rewrite = 0;
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) != S.charAt(i + j)) rewrite++;
            }
            min = Math.min(min, rewrite);
        }
        System.out.println(min);
    }
}
