import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.*;
import java.math.*;
import java.util.*;
class Main{

    public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String S = br.readLine();
        String t = br.readLine();
        int min = Integer.MAX_VALUE;
        for(int i = 0; i < S.length() - t.length() + 1; i++){

            String s = S.substring(i, i + t.length());

            int count = 0;
            for(int j = 0; j < t.length(); j++){
                if(t.charAt(j) != s.charAt(j)){
                    count++;
                }
                if(count >= min){
                    break;
                }
                
            }
            min = Math.min(min, count);

        }
        System.out.print(min);
    }  

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.*; io.* java import java.math.*; math.* java import java.util.*; util.* java class Main{

    public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String S = br.readLine();
        String t = br.readLine();
        int min = Integer.MAX_VALUE;
        for(int i = 0; i < S.length() - t.length() + 1; i++){

            String s = S.substring(i, i + t.length());

            int count = 0;
            for(int j = 0; j < t.length(); j++){
                if(t.charAt(j) != s.charAt(j)){
                    count++;
                }
                if(count >= min){
                    break;
                }
                
            }
            min = Math.min(min, count);

        }
        System.out.print(min);
    }  

} Main public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String S = br.readLine();
        String t = br.readLine();
        int min = Integer.MAX_VALUE;
        for(int i = 0; i < S.length() - t.length() + 1; i++){

            String s = S.substring(i, i + t.length());

            int count = 0;
            for(int j = 0; j < t.length(); j++){
                if(t.charAt(j) != s.charAt(j)){
                    count++;
                }
                if(count >= min){
                    break;
                }
                
            }
            min = Math.min(min, count);

        }
        System.out.print(min);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String S = br.readLine();
        String t = br.readLine();
        int min = Integer.MAX_VALUE;
        for(int i = 0; i < S.length() - t.length() + 1; i++){

            String s = S.substring(i, i + t.length());

            int count = 0;
            for(int j = 0; j < t.length(); j++){
                if(t.charAt(j) != s.charAt(j)){
                    count++;
                }
                if(count >= min){
                    break;
                }
                
            }
            min = Math.min(min, count);

        }
        System.out.print(min);
    } 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 min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i = 0; i < S.length() - t.length() + 1; i++){

            String s = S.substring(i, i + t.length());

            int count = 0;
            for(int j = 0; j < t.length(); j++){
                if(t.charAt(j) != s.charAt(j)){
                    count++;
                }
                if(count >= min){
                    break;
                }
                
            }
            min = Math.min(min, count);

        } 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 {

            String s = S.substring(i, i + t.length());

            int count = 0;
            for(int j = 0; j < t.length(); j++){
                if(t.charAt(j) != s.charAt(j)){
                    count++;
                }
                if(count >= min){
                    break;
                }
                
            }
            min = Math.min(min, count);

        } {

            String s = S.substring(i, i + t.length());

            int count = 0;
            for(int j = 0; j < t.length(); j++){
                if(t.charAt(j) != s.charAt(j)){
                    count++;
                }
                if(count >= min){
                    break;
                }
                
            }
            min = Math.min(min, count);

        } String s = S.substring(i, i + t.length()); s S.substring(i, i + t.length()) S.substring S i i + t.length() i t.length() t.length t int count = 0; count 0 for(int j = 0; j < t.length(); j++){
                if(t.charAt(j) != s.charAt(j)){
                    count++;
                }
                if(count >= min){
                    break;
                }
                
            } 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(j)){
                    count++;
                }
                if(count >= min){
                    break;
                }
                
            } {
                if(t.charAt(j) != s.charAt(j)){
                    count++;
                }
                if(count >= min){
                    break;
                }
                
            } if(t.charAt(j) != s.charAt(j)){
                    count++;
                } t.charAt(j) != s.charAt(j) t.charAt(j) t.charAt t j s.charAt(j) s.charAt s j {
                    count++;
                } count++ count if(count >= min){
                    break;
                } count >= min count min {
                    break;
                } break; min = Math.min(min, count) min Math.min(min, count) Math.min Math min count System.out.print(min) System.out.print System.out System System.out min String[] args args
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.*;
import java.math.*;
import java.util.*;
class Main{

    public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String S = br.readLine();
        String t = br.readLine();
        int min = Integer.MAX_VALUE;
        for(int i = 0; i < S.length() - t.length() + 1; i++){

            String s = S.substring(i, i + t.length());

            int count = 0;
            for(int j = 0; j < t.length(); j++){
                if(t.charAt(j) != s.charAt(j)){
                    count++;
                }
                if(count >= min){
                    break;
                }
                
            }
            min = Math.min(min, count);

        }
        System.out.print(min);
    }  

}