import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int sn = s.length();
        int tn = t.length();
        int max = 0;
        int count = 0;
        for(int i = 0; i < sn-tn+1; i++){
            for(int j = 0; j < tn; j++){
                if(s.charAt(i+j) == t.charAt(j)){
                    count++;
                }
            }
            max = Math.max(max, count);
            count = 0;
        }
        System.out.println(tn-max);
    }
} import java.util.*; util.* java class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int sn = s.length();
        int tn = t.length();
        int max = 0;
        int count = 0;
        for(int i = 0; i < sn-tn+1; i++){
            for(int j = 0; j < tn; j++){
                if(s.charAt(i+j) == t.charAt(j)){
                    count++;
                }
            }
            max = Math.max(max, count);
            count = 0;
        }
        System.out.println(tn-max);
    }
} Main public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int sn = s.length();
        int tn = t.length();
        int max = 0;
        int count = 0;
        for(int i = 0; i < sn-tn+1; i++){
            for(int j = 0; j < tn; j++){
                if(s.charAt(i+j) == t.charAt(j)){
                    count++;
                }
            }
            max = Math.max(max, count);
            count = 0;
        }
        System.out.println(tn-max);
    } main {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int sn = s.length();
        int tn = t.length();
        int max = 0;
        int count = 0;
        for(int i = 0; i < sn-tn+1; i++){
            for(int j = 0; j < tn; j++){
                if(s.charAt(i+j) == t.charAt(j)){
                    count++;
                }
            }
            max = Math.max(max, count);
            count = 0;
        }
        System.out.println(tn-max);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String s = scanner.next(); s scanner.next() scanner.next scanner String t = scanner.next(); t scanner.next() scanner.next scanner int sn = s.length(); sn s.length() s.length s int tn = t.length(); tn t.length() t.length t int max = 0; max 0 int count = 0; count 0 for(int i = 0; i < sn-tn+1; i++){
            for(int j = 0; j < tn; j++){
                if(s.charAt(i+j) == t.charAt(j)){
                    count++;
                }
            }
            max = Math.max(max, count);
            count = 0;
        } int i = 0; int i = 0; i 0 i < sn-tn+1 i sn-tn+1 sn-tn sn tn 1 i++ i++ i {
            for(int j = 0; j < tn; j++){
                if(s.charAt(i+j) == t.charAt(j)){
                    count++;
                }
            }
            max = Math.max(max, count);
            count = 0;
        } {
            for(int j = 0; j < tn; j++){
                if(s.charAt(i+j) == t.charAt(j)){
                    count++;
                }
            }
            max = Math.max(max, count);
            count = 0;
        } for(int j = 0; j < tn; j++){
                if(s.charAt(i+j) == t.charAt(j)){
                    count++;
                }
            } int j = 0; int j = 0; j 0 j < tn j tn j++ j++ j {
                if(s.charAt(i+j) == t.charAt(j)){
                    count++;
                }
            } {
                if(s.charAt(i+j) == t.charAt(j)){
                    count++;
                }
            } if(s.charAt(i+j) == t.charAt(j)){
                    count++;
                } 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 {
                    count++;
                } count++ count max = Math.max(max, count) max Math.max(max, count) Math.max Math max count count = 0 count 0 System.out.println(tn-max) System.out.println System.out System System.out tn-max tn max String[] args args
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int sn = s.length();
        int tn = t.length();
        int max = 0;
        int count = 0;
        for(int i = 0; i < sn-tn+1; i++){
            for(int j = 0; j < tn; j++){
                if(s.charAt(i+j) == t.charAt(j)){
                    count++;
                }
            }
            max = Math.max(max, count);
            count = 0;
        }
        System.out.println(tn-max);
    }
}