import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    char[] ss = s.toCharArray();
    String t = sc.next();
    char[] tt = t.toCharArray();
    int difmin = 100000;
    for(int i = 0;i<=s.length()-t.length();i++){
      int dif = 0;
      for(int j = 0;j<t.length();j++){
        if(ss[i+j]!=tt[j])dif++;
      }
      difmin = Math.min(dif,difmin);
    }
    System.out.println(difmin);
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    char[] ss = s.toCharArray();
    String t = sc.next();
    char[] tt = t.toCharArray();
    int difmin = 100000;
    for(int i = 0;i<=s.length()-t.length();i++){
      int dif = 0;
      for(int j = 0;j<t.length();j++){
        if(ss[i+j]!=tt[j])dif++;
      }
      difmin = Math.min(dif,difmin);
    }
    System.out.println(difmin);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    char[] ss = s.toCharArray();
    String t = sc.next();
    char[] tt = t.toCharArray();
    int difmin = 100000;
    for(int i = 0;i<=s.length()-t.length();i++){
      int dif = 0;
      for(int j = 0;j<t.length();j++){
        if(ss[i+j]!=tt[j])dif++;
      }
      difmin = Math.min(dif,difmin);
    }
    System.out.println(difmin);
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    char[] ss = s.toCharArray();
    String t = sc.next();
    char[] tt = t.toCharArray();
    int difmin = 100000;
    for(int i = 0;i<=s.length()-t.length();i++){
      int dif = 0;
      for(int j = 0;j<t.length();j++){
        if(ss[i+j]!=tt[j])dif++;
      }
      difmin = Math.min(dif,difmin);
    }
    System.out.println(difmin);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc char[] ss = s.toCharArray(); ss s.toCharArray() s.toCharArray s String t = sc.next(); t sc.next() sc.next sc char[] tt = t.toCharArray(); tt t.toCharArray() t.toCharArray t int difmin = 100000; difmin 100000 for(int i = 0;i<=s.length()-t.length();i++){
      int dif = 0;
      for(int j = 0;j<t.length();j++){
        if(ss[i+j]!=tt[j])dif++;
      }
      difmin = Math.min(dif,difmin);
    } int i = 0; int i = 0; i 0 i<=s.length()-t.length() i s.length()-t.length() s.length() s.length s t.length() t.length t i++ i++ i {
      int dif = 0;
      for(int j = 0;j<t.length();j++){
        if(ss[i+j]!=tt[j])dif++;
      }
      difmin = Math.min(dif,difmin);
    } {
      int dif = 0;
      for(int j = 0;j<t.length();j++){
        if(ss[i+j]!=tt[j])dif++;
      }
      difmin = Math.min(dif,difmin);
    } int dif = 0; dif 0 for(int j = 0;j<t.length();j++){
        if(ss[i+j]!=tt[j])dif++;
      } int j = 0; int j = 0; j 0 j<t.length() j t.length() t.length t j++ j++ j {
        if(ss[i+j]!=tt[j])dif++;
      } {
        if(ss[i+j]!=tt[j])dif++;
      } if(ss[i+j]!=tt[j])dif++; ss[i+j]!=tt[j] ss[i+j] ss i+j i j tt[j] tt j dif++ dif difmin = Math.min(dif,difmin) difmin Math.min(dif,difmin) Math.min Math dif difmin System.out.println(difmin) System.out.println System.out System System.out difmin String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    char[] ss = s.toCharArray();
    String t = sc.next();
    char[] tt = t.toCharArray();
    int difmin = 100000;
    for(int i = 0;i<=s.length()-t.length();i++){
      int dif = 0;
      for(int j = 0;j<t.length();j++){
        if(ss[i+j]!=tt[j])dif++;
      }
      difmin = Math.min(dif,difmin);
    }
    System.out.println(difmin);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    char[] ss = s.toCharArray();
    String t = sc.next();
    char[] tt = t.toCharArray();
    int difmin = 100000;
    for(int i = 0;i<=s.length()-t.length();i++){
      int dif = 0;
      for(int j = 0;j<t.length();j++){
        if(ss[i+j]!=tt[j])dif++;
      }
      difmin = Math.min(dif,difmin);
    }
    System.out.println(difmin);
  }
} Main
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    char[] ss = s.toCharArray();
    String t = sc.next();
    char[] tt = t.toCharArray();
    int difmin = 100000;
    for(int i = 0;i<=s.length()-t.length();i++){
      int dif = 0;
      for(int j = 0;j<t.length();j++){
        if(ss[i+j]!=tt[j])dif++;
      }
      difmin = Math.min(dif,difmin);
    }
    System.out.println(difmin);
  }
}
