import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();

        //0回
        if(s.contains(t)){
            System.out.println(0);
          return;
        }

        char tj;
        char sj;
        int startcount = 0;
        int matchcount = 0;
        int min = 0;

        for(int i=0; i<s.length()-t.length()+1;i++){
            matchcount = 0;
            for(int j=0; j<t.length(); j++){
                tj = t.charAt(j);
                sj = s.charAt(j+startcount);
                if(tj==sj){
                    matchcount++;
                }
            }
            
            if(min==0 || min > t.length() - matchcount){
                min = t.length() - matchcount;
            }
            startcount ++;
        }
        System.out.println(min);
        sc.close();
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();

        //0回
        if(s.contains(t)){
            System.out.println(0);
          return;
        }

        char tj;
        char sj;
        int startcount = 0;
        int matchcount = 0;
        int min = 0;

        for(int i=0; i<s.length()-t.length()+1;i++){
            matchcount = 0;
            for(int j=0; j<t.length(); j++){
                tj = t.charAt(j);
                sj = s.charAt(j+startcount);
                if(tj==sj){
                    matchcount++;
                }
            }
            
            if(min==0 || min > t.length() - matchcount){
                min = t.length() - matchcount;
            }
            startcount ++;
        }
        System.out.println(min);
        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();

        //0回
        if(s.contains(t)){
            System.out.println(0);
          return;
        }

        char tj;
        char sj;
        int startcount = 0;
        int matchcount = 0;
        int min = 0;

        for(int i=0; i<s.length()-t.length()+1;i++){
            matchcount = 0;
            for(int j=0; j<t.length(); j++){
                tj = t.charAt(j);
                sj = s.charAt(j+startcount);
                if(tj==sj){
                    matchcount++;
                }
            }
            
            if(min==0 || min > t.length() - matchcount){
                min = t.length() - matchcount;
            }
            startcount ++;
        }
        System.out.println(min);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();

        //0回
        if(s.contains(t)){
            System.out.println(0);
          return;
        }

        char tj;
        char sj;
        int startcount = 0;
        int matchcount = 0;
        int min = 0;

        for(int i=0; i<s.length()-t.length()+1;i++){
            matchcount = 0;
            for(int j=0; j<t.length(); j++){
                tj = t.charAt(j);
                sj = s.charAt(j+startcount);
                if(tj==sj){
                    matchcount++;
                }
            }
            
            if(min==0 || min > t.length() - matchcount){
                min = t.length() - matchcount;
            }
            startcount ++;
        }
        System.out.println(min);
        sc.close();
    } 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 if(s.contains(t)){
            System.out.println(0);
          return;
        } s.contains(t) s.contains s t {
            System.out.println(0);
          return;
        } System.out.println(0) System.out.println System.out System System.out 0 return; char tj; tj char sj; sj int startcount = 0; startcount 0 int matchcount = 0; matchcount 0 int min = 0; min 0 for(int i=0; i<s.length()-t.length()+1;i++){
            matchcount = 0;
            for(int j=0; j<t.length(); j++){
                tj = t.charAt(j);
                sj = s.charAt(j+startcount);
                if(tj==sj){
                    matchcount++;
                }
            }
            
            if(min==0 || min > t.length() - matchcount){
                min = t.length() - matchcount;
            }
            startcount ++;
        } int i=0; int i=0; i 0 i<s.length()-t.length()+1 i s.length()-t.length()+1 s.length()-t.length() s.length() s.length s t.length() t.length t 1 i++ i++ i {
            matchcount = 0;
            for(int j=0; j<t.length(); j++){
                tj = t.charAt(j);
                sj = s.charAt(j+startcount);
                if(tj==sj){
                    matchcount++;
                }
            }
            
            if(min==0 || min > t.length() - matchcount){
                min = t.length() - matchcount;
            }
            startcount ++;
        } {
            matchcount = 0;
            for(int j=0; j<t.length(); j++){
                tj = t.charAt(j);
                sj = s.charAt(j+startcount);
                if(tj==sj){
                    matchcount++;
                }
            }
            
            if(min==0 || min > t.length() - matchcount){
                min = t.length() - matchcount;
            }
            startcount ++;
        } matchcount = 0 matchcount 0 for(int j=0; j<t.length(); j++){
                tj = t.charAt(j);
                sj = s.charAt(j+startcount);
                if(tj==sj){
                    matchcount++;
                }
            } int j=0; int j=0; j 0 j<t.length() j t.length() t.length t j++ j++ j {
                tj = t.charAt(j);
                sj = s.charAt(j+startcount);
                if(tj==sj){
                    matchcount++;
                }
            } {
                tj = t.charAt(j);
                sj = s.charAt(j+startcount);
                if(tj==sj){
                    matchcount++;
                }
            } tj = t.charAt(j) tj t.charAt(j) t.charAt t j sj = s.charAt(j+startcount) sj s.charAt(j+startcount) s.charAt s j+startcount j startcount if(tj==sj){
                    matchcount++;
                } tj==sj tj sj {
                    matchcount++;
                } matchcount++ matchcount if(min==0 || min > t.length() - matchcount){
                min = t.length() - matchcount;
            } min==0 || min > t.length() - matchcount min==0 min 0 min > t.length() - matchcount min t.length() - matchcount t.length() t.length t matchcount {
                min = t.length() - matchcount;
            } min = t.length() - matchcount min t.length() - matchcount t.length() t.length t matchcount startcount ++ startcount System.out.println(min) System.out.println System.out System System.out min sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();

        //0回
        if(s.contains(t)){
            System.out.println(0);
          return;
        }

        char tj;
        char sj;
        int startcount = 0;
        int matchcount = 0;
        int min = 0;

        for(int i=0; i<s.length()-t.length()+1;i++){
            matchcount = 0;
            for(int j=0; j<t.length(); j++){
                tj = t.charAt(j);
                sj = s.charAt(j+startcount);
                if(tj==sj){
                    matchcount++;
                }
            }
            
            if(min==0 || min > t.length() - matchcount){
                min = t.length() - matchcount;
            }
            startcount ++;
        }
        System.out.println(min);
        sc.close();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();

        //0回
        if(s.contains(t)){
            System.out.println(0);
          return;
        }

        char tj;
        char sj;
        int startcount = 0;
        int matchcount = 0;
        int min = 0;

        for(int i=0; i<s.length()-t.length()+1;i++){
            matchcount = 0;
            for(int j=0; j<t.length(); j++){
                tj = t.charAt(j);
                sj = s.charAt(j+startcount);
                if(tj==sj){
                    matchcount++;
                }
            }
            
            if(min==0 || min > t.length() - matchcount){
                min = t.length() - matchcount;
            }
            startcount ++;
        }
        System.out.println(min);
        sc.close();
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();

        //0回
        if(s.contains(t)){
            System.out.println(0);
          return;
        }

        char tj;
        char sj;
        int startcount = 0;
        int matchcount = 0;
        int min = 0;

        for(int i=0; i<s.length()-t.length()+1;i++){
            matchcount = 0;
            for(int j=0; j<t.length(); j++){
                tj = t.charAt(j);
                sj = s.charAt(j+startcount);
                if(tj==sj){
                    matchcount++;
                }
            }
            
            if(min==0 || min > t.length() - matchcount){
                min = t.length() - matchcount;
            }
            startcount ++;
        }
        System.out.println(min);
        sc.close();
    }
}
