import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        char[] c1 = sc.next().toCharArray();
        char[] c2 = sc.next().toCharArray();
        int num1 = c1.length;
        int num2 = c2.length;
        int count = 0;
        
        for(int i=0; i<(num1-num2+1); i++){
          int cc = 0;
          for(int j=0; j<c2.length; j++){
              if(c1[i+j]==c2[j]){
                  cc++;
              }
          }
          if(count<cc){
              count = cc;
              //System.out.println("i "+ i);
              //System.out.println("cc "+ cc);
              
          }
        }

        System.out.println(num2-count);
        
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        char[] c1 = sc.next().toCharArray();
        char[] c2 = sc.next().toCharArray();
        int num1 = c1.length;
        int num2 = c2.length;
        int count = 0;
        
        for(int i=0; i<(num1-num2+1); i++){
          int cc = 0;
          for(int j=0; j<c2.length; j++){
              if(c1[i+j]==c2[j]){
                  cc++;
              }
          }
          if(count<cc){
              count = cc;
              //System.out.println("i "+ i);
              //System.out.println("cc "+ cc);
              
          }
        }

        System.out.println(num2-count);
        
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        char[] c1 = sc.next().toCharArray();
        char[] c2 = sc.next().toCharArray();
        int num1 = c1.length;
        int num2 = c2.length;
        int count = 0;
        
        for(int i=0; i<(num1-num2+1); i++){
          int cc = 0;
          for(int j=0; j<c2.length; j++){
              if(c1[i+j]==c2[j]){
                  cc++;
              }
          }
          if(count<cc){
              count = cc;
              //System.out.println("i "+ i);
              //System.out.println("cc "+ cc);
              
          }
        }

        System.out.println(num2-count);
        
    } main {
        Scanner sc = new Scanner(System.in);
        char[] c1 = sc.next().toCharArray();
        char[] c2 = sc.next().toCharArray();
        int num1 = c1.length;
        int num2 = c2.length;
        int count = 0;
        
        for(int i=0; i<(num1-num2+1); i++){
          int cc = 0;
          for(int j=0; j<c2.length; j++){
              if(c1[i+j]==c2[j]){
                  cc++;
              }
          }
          if(count<cc){
              count = cc;
              //System.out.println("i "+ i);
              //System.out.println("cc "+ cc);
              
          }
        }

        System.out.println(num2-count);
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] c1 = sc.next().toCharArray(); c1 sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc char[] c2 = sc.next().toCharArray(); c2 sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc int num1 = c1.length; num1 c1.length c1 c1.length int num2 = c2.length; num2 c2.length c2 c2.length int count = 0; count 0 for(int i=0; i<(num1-num2+1); i++){
          int cc = 0;
          for(int j=0; j<c2.length; j++){
              if(c1[i+j]==c2[j]){
                  cc++;
              }
          }
          if(count<cc){
              count = cc;
              //System.out.println("i "+ i);
              //System.out.println("cc "+ cc);
              
          }
        } int i=0; int i=0; i 0 i<(num1-num2+1) i (num1-num2+1) num1-num2 num1 num2 1 i++ i++ i {
          int cc = 0;
          for(int j=0; j<c2.length; j++){
              if(c1[i+j]==c2[j]){
                  cc++;
              }
          }
          if(count<cc){
              count = cc;
              //System.out.println("i "+ i);
              //System.out.println("cc "+ cc);
              
          }
        } {
          int cc = 0;
          for(int j=0; j<c2.length; j++){
              if(c1[i+j]==c2[j]){
                  cc++;
              }
          }
          if(count<cc){
              count = cc;
              //System.out.println("i "+ i);
              //System.out.println("cc "+ cc);
              
          }
        } int cc = 0; cc 0 for(int j=0; j<c2.length; j++){
              if(c1[i+j]==c2[j]){
                  cc++;
              }
          } int j=0; int j=0; j 0 j<c2.length j c2.length c2 c2.length j++ j++ j {
              if(c1[i+j]==c2[j]){
                  cc++;
              }
          } {
              if(c1[i+j]==c2[j]){
                  cc++;
              }
          } if(c1[i+j]==c2[j]){
                  cc++;
              } c1[i+j]==c2[j] c1[i+j] c1 i+j i j c2[j] c2 j {
                  cc++;
              } cc++ cc if(count<cc){
              count = cc;
              //System.out.println("i "+ i);
              //System.out.println("cc "+ cc);
              
          } count<cc count cc {
              count = cc;
              //System.out.println("i "+ i);
              //System.out.println("cc "+ cc);
              
          } count = cc count cc System.out.println(num2-count) System.out.println System.out System System.out num2-count num2 count String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        char[] c1 = sc.next().toCharArray();
        char[] c2 = sc.next().toCharArray();
        int num1 = c1.length;
        int num2 = c2.length;
        int count = 0;
        
        for(int i=0; i<(num1-num2+1); i++){
          int cc = 0;
          for(int j=0; j<c2.length; j++){
              if(c1[i+j]==c2[j]){
                  cc++;
              }
          }
          if(count<cc){
              count = cc;
              //System.out.println("i "+ i);
              //System.out.println("cc "+ cc);
              
          }
        }

        System.out.println(num2-count);
        
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        char[] c1 = sc.next().toCharArray();
        char[] c2 = sc.next().toCharArray();
        int num1 = c1.length;
        int num2 = c2.length;
        int count = 0;
        
        for(int i=0; i<(num1-num2+1); i++){
          int cc = 0;
          for(int j=0; j<c2.length; j++){
              if(c1[i+j]==c2[j]){
                  cc++;
              }
          }
          if(count<cc){
              count = cc;
              //System.out.println("i "+ i);
              //System.out.println("cc "+ cc);
              
          }
        }

        System.out.println(num2-count);
        
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        char[] c1 = sc.next().toCharArray();
        char[] c2 = sc.next().toCharArray();
        int num1 = c1.length;
        int num2 = c2.length;
        int count = 0;
        
        for(int i=0; i<(num1-num2+1); i++){
          int cc = 0;
          for(int j=0; j<c2.length; j++){
              if(c1[i+j]==c2[j]){
                  cc++;
              }
          }
          if(count<cc){
              count = cc;
              //System.out.println("i "+ i);
              //System.out.println("cc "+ cc);
              
          }
        }

        System.out.println(num2-count);
        
    }
}