import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String t = br.readLine();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < s.length(); i++) {
            int misMatchCount = 0;
            boolean  flag = true;
            for (int j = 0; j < t.length(); j++) {
                if(i + j >= s.length()){
                    flag = false;
                    break;
                }
                if(s.charAt(i+ j) != t.charAt(j)) {
                    ++misMatchCount;
                }
            }
            if(flag)
                ans = Math.min(ans,misMatchCount);
        }
        System.out.println(ans);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String t = br.readLine();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < s.length(); i++) {
            int misMatchCount = 0;
            boolean  flag = true;
            for (int j = 0; j < t.length(); j++) {
                if(i + j >= s.length()){
                    flag = false;
                    break;
                }
                if(s.charAt(i+ j) != t.charAt(j)) {
                    ++misMatchCount;
                }
            }
            if(flag)
                ans = Math.min(ans,misMatchCount);
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String t = br.readLine();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < s.length(); i++) {
            int misMatchCount = 0;
            boolean  flag = true;
            for (int j = 0; j < t.length(); j++) {
                if(i + j >= s.length()){
                    flag = false;
                    break;
                }
                if(s.charAt(i+ j) != t.charAt(j)) {
                    ++misMatchCount;
                }
            }
            if(flag)
                ans = Math.min(ans,misMatchCount);
        }
        System.out.println(ans);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String t = br.readLine();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < s.length(); i++) {
            int misMatchCount = 0;
            boolean  flag = true;
            for (int j = 0; j < t.length(); j++) {
                if(i + j >= s.length()){
                    flag = false;
                    break;
                }
                if(s.charAt(i+ j) != t.charAt(j)) {
                    ++misMatchCount;
                }
            }
            if(flag)
                ans = Math.min(ans,misMatchCount);
        }
        System.out.println(ans);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String s = br.readLine(); s br.readLine() br.readLine br String t = br.readLine(); t br.readLine() br.readLine br int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = 0; i < s.length(); i++) {
            int misMatchCount = 0;
            boolean  flag = true;
            for (int j = 0; j < t.length(); j++) {
                if(i + j >= s.length()){
                    flag = false;
                    break;
                }
                if(s.charAt(i+ j) != t.charAt(j)) {
                    ++misMatchCount;
                }
            }
            if(flag)
                ans = Math.min(ans,misMatchCount);
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            int misMatchCount = 0;
            boolean  flag = true;
            for (int j = 0; j < t.length(); j++) {
                if(i + j >= s.length()){
                    flag = false;
                    break;
                }
                if(s.charAt(i+ j) != t.charAt(j)) {
                    ++misMatchCount;
                }
            }
            if(flag)
                ans = Math.min(ans,misMatchCount);
        } {
            int misMatchCount = 0;
            boolean  flag = true;
            for (int j = 0; j < t.length(); j++) {
                if(i + j >= s.length()){
                    flag = false;
                    break;
                }
                if(s.charAt(i+ j) != t.charAt(j)) {
                    ++misMatchCount;
                }
            }
            if(flag)
                ans = Math.min(ans,misMatchCount);
        } int misMatchCount = 0; misMatchCount 0 boolean  flag = true; flag true for (int j = 0; j < t.length(); j++) {
                if(i + j >= s.length()){
                    flag = false;
                    break;
                }
                if(s.charAt(i+ j) != t.charAt(j)) {
                    ++misMatchCount;
                }
            } int j = 0; int j = 0; j 0 j < t.length() j t.length() t.length t j++ j++ j {
                if(i + j >= s.length()){
                    flag = false;
                    break;
                }
                if(s.charAt(i+ j) != t.charAt(j)) {
                    ++misMatchCount;
                }
            } {
                if(i + j >= s.length()){
                    flag = false;
                    break;
                }
                if(s.charAt(i+ j) != t.charAt(j)) {
                    ++misMatchCount;
                }
            } if(i + j >= s.length()){
                    flag = false;
                    break;
                } i + j >= s.length() i + j i j s.length() s.length s {
                    flag = false;
                    break;
                } flag = false flag false break; if(s.charAt(i+ j) != t.charAt(j)) {
                    ++misMatchCount;
                } 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 {
                    ++misMatchCount;
                } ++misMatchCount misMatchCount if(flag)
                ans = Math.min(ans,misMatchCount); flag ans = Math.min(ans,misMatchCount) ans Math.min(ans,misMatchCount) Math.min Math ans misMatchCount System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String t = br.readLine();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < s.length(); i++) {
            int misMatchCount = 0;
            boolean  flag = true;
            for (int j = 0; j < t.length(); j++) {
                if(i + j >= s.length()){
                    flag = false;
                    break;
                }
                if(s.charAt(i+ j) != t.charAt(j)) {
                    ++misMatchCount;
                }
            }
            if(flag)
                ans = Math.min(ans,misMatchCount);
        }
        System.out.println(ans);
    }
}
