import java.util.*;

public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String t = scan.next();
        int n = s.length();
        int m = t.length();
        int min = 1001;
        for(int i = 0; i < n - m + 1; i++){
            int out = 0;
            if(s.substring(i, i + m).equals(t)){
                System.out.println(0);
                return;
            }
            for(int j = i; j < i + m; j++){
                if(s.charAt(j) != t.charAt(j - i)) out++;
            }
            min = Math.min(out, min);
        }
        System.out.println(min);
    }

    public static void main(String[] args){
        new Main().solve();
    }
} import java.util.*; util.* java public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String t = scan.next();
        int n = s.length();
        int m = t.length();
        int min = 1001;
        for(int i = 0; i < n - m + 1; i++){
            int out = 0;
            if(s.substring(i, i + m).equals(t)){
                System.out.println(0);
                return;
            }
            for(int j = i; j < i + m; j++){
                if(s.charAt(j) != t.charAt(j - i)) out++;
            }
            min = Math.min(out, min);
        }
        System.out.println(min);
    }

    public static void main(String[] args){
        new Main().solve();
    }
} Main void solve(){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String t = scan.next();
        int n = s.length();
        int m = t.length();
        int min = 1001;
        for(int i = 0; i < n - m + 1; i++){
            int out = 0;
            if(s.substring(i, i + m).equals(t)){
                System.out.println(0);
                return;
            }
            for(int j = i; j < i + m; j++){
                if(s.charAt(j) != t.charAt(j - i)) out++;
            }
            min = Math.min(out, min);
        }
        System.out.println(min);
    } solve {
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String t = scan.next();
        int n = s.length();
        int m = t.length();
        int min = 1001;
        for(int i = 0; i < n - m + 1; i++){
            int out = 0;
            if(s.substring(i, i + m).equals(t)){
                System.out.println(0);
                return;
            }
            for(int j = i; j < i + m; j++){
                if(s.charAt(j) != t.charAt(j - i)) out++;
            }
            min = Math.min(out, min);
        }
        System.out.println(min);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan String t = scan.next(); t scan.next() scan.next scan int n = s.length(); n s.length() s.length s int m = t.length(); m t.length() t.length t int min = 1001; min 1001 for(int i = 0; i < n - m + 1; i++){
            int out = 0;
            if(s.substring(i, i + m).equals(t)){
                System.out.println(0);
                return;
            }
            for(int j = i; j < i + m; j++){
                if(s.charAt(j) != t.charAt(j - i)) out++;
            }
            min = Math.min(out, min);
        } int i = 0; int i = 0; i 0 i < n - m + 1 i n - m + 1 n - m n m 1 i++ i++ i {
            int out = 0;
            if(s.substring(i, i + m).equals(t)){
                System.out.println(0);
                return;
            }
            for(int j = i; j < i + m; j++){
                if(s.charAt(j) != t.charAt(j - i)) out++;
            }
            min = Math.min(out, min);
        } {
            int out = 0;
            if(s.substring(i, i + m).equals(t)){
                System.out.println(0);
                return;
            }
            for(int j = i; j < i + m; j++){
                if(s.charAt(j) != t.charAt(j - i)) out++;
            }
            min = Math.min(out, min);
        } int out = 0; out 0 if(s.substring(i, i + m).equals(t)){
                System.out.println(0);
                return;
            } s.substring(i, i + m).equals(t) s.substring(i, i + m).equals s.substring(i, i + m) s.substring s i i + m i m t {
                System.out.println(0);
                return;
            } System.out.println(0) System.out.println System.out System System.out 0 return; for(int j = i; j < i + m; j++){
                if(s.charAt(j) != t.charAt(j - i)) out++;
            } int j = i; int j = i; j i j < i + m j i + m i m j++ j++ j {
                if(s.charAt(j) != t.charAt(j - i)) out++;
            } {
                if(s.charAt(j) != t.charAt(j - i)) out++;
            } if(s.charAt(j) != t.charAt(j - i)) out++; s.charAt(j) != t.charAt(j - i) s.charAt(j) s.charAt s j t.charAt(j - i) t.charAt t j - i j i out++ out min = Math.min(out, min) min Math.min(out, min) Math.min Math out min System.out.println(min) System.out.println System.out System System.out min public static void main(String[] args){
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String t = scan.next();
        int n = s.length();
        int m = t.length();
        int min = 1001;
        for(int i = 0; i < n - m + 1; i++){
            int out = 0;
            if(s.substring(i, i + m).equals(t)){
                System.out.println(0);
                return;
            }
            for(int j = i; j < i + m; j++){
                if(s.charAt(j) != t.charAt(j - i)) out++;
            }
            min = Math.min(out, min);
        }
        System.out.println(min);
    }

    public static void main(String[] args){
        new Main().solve();
    }
} public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String t = scan.next();
        int n = s.length();
        int m = t.length();
        int min = 1001;
        for(int i = 0; i < n - m + 1; i++){
            int out = 0;
            if(s.substring(i, i + m).equals(t)){
                System.out.println(0);
                return;
            }
            for(int j = i; j < i + m; j++){
                if(s.charAt(j) != t.charAt(j - i)) out++;
            }
            min = Math.min(out, min);
        }
        System.out.println(min);
    }

    public static void main(String[] args){
        new Main().solve();
    }
} Main
import java.util.*;

public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String t = scan.next();
        int n = s.length();
        int m = t.length();
        int min = 1001;
        for(int i = 0; i < n - m + 1; i++){
            int out = 0;
            if(s.substring(i, i + m).equals(t)){
                System.out.println(0);
                return;
            }
            for(int j = i; j < i + m; j++){
                if(s.charAt(j) != t.charAt(j - i)) out++;
            }
            min = Math.min(out, min);
        }
        System.out.println(min);
    }

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