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();
    if(s.indexOf(t)!=-1){
      System.out.println(0);
    }
    else{
      int min=Integer.MAX_VALUE;
      for(int i=0;i<=s.length()-t.length();i++){
        //System.out.println(s.substring(i,i+t.length()));
        if(min>helper(s.substring(i,i+t.length()),t)){
          min=helper(s.substring(i,i+t.length()),t);
        }
      }
      System.out.println(min);
    }
  }
  public static int helper(String s1, String s2){
    int count=0;
    for(int i=0;i<s1.length();i++){
      if(s1.charAt(i)!=s2.charAt(i)){
        count++;
      }
    }
    return count;
  }
} 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();
    if(s.indexOf(t)!=-1){
      System.out.println(0);
    }
    else{
      int min=Integer.MAX_VALUE;
      for(int i=0;i<=s.length()-t.length();i++){
        //System.out.println(s.substring(i,i+t.length()));
        if(min>helper(s.substring(i,i+t.length()),t)){
          min=helper(s.substring(i,i+t.length()),t);
        }
      }
      System.out.println(min);
    }
  }
  public static int helper(String s1, String s2){
    int count=0;
    for(int i=0;i<s1.length();i++){
      if(s1.charAt(i)!=s2.charAt(i)){
        count++;
      }
    }
    return count;
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    if(s.indexOf(t)!=-1){
      System.out.println(0);
    }
    else{
      int min=Integer.MAX_VALUE;
      for(int i=0;i<=s.length()-t.length();i++){
        //System.out.println(s.substring(i,i+t.length()));
        if(min>helper(s.substring(i,i+t.length()),t)){
          min=helper(s.substring(i,i+t.length()),t);
        }
      }
      System.out.println(min);
    }
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    if(s.indexOf(t)!=-1){
      System.out.println(0);
    }
    else{
      int min=Integer.MAX_VALUE;
      for(int i=0;i<=s.length()-t.length();i++){
        //System.out.println(s.substring(i,i+t.length()));
        if(min>helper(s.substring(i,i+t.length()),t)){
          min=helper(s.substring(i,i+t.length()),t);
        }
      }
      System.out.println(min);
    }
  } 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.indexOf(t)!=-1){
      System.out.println(0);
    }
    else{
      int min=Integer.MAX_VALUE;
      for(int i=0;i<=s.length()-t.length();i++){
        //System.out.println(s.substring(i,i+t.length()));
        if(min>helper(s.substring(i,i+t.length()),t)){
          min=helper(s.substring(i,i+t.length()),t);
        }
      }
      System.out.println(min);
    } s.indexOf(t)!=-1 s.indexOf(t) s.indexOf s t -1 1 {
      System.out.println(0);
    } System.out.println(0) System.out.println System.out System System.out 0 {
      int min=Integer.MAX_VALUE;
      for(int i=0;i<=s.length()-t.length();i++){
        //System.out.println(s.substring(i,i+t.length()));
        if(min>helper(s.substring(i,i+t.length()),t)){
          min=helper(s.substring(i,i+t.length()),t);
        }
      }
      System.out.println(min);
    } int min=Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i=0;i<=s.length()-t.length();i++){
        //System.out.println(s.substring(i,i+t.length()));
        if(min>helper(s.substring(i,i+t.length()),t)){
          min=helper(s.substring(i,i+t.length()),t);
        }
      } 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 {
        //System.out.println(s.substring(i,i+t.length()));
        if(min>helper(s.substring(i,i+t.length()),t)){
          min=helper(s.substring(i,i+t.length()),t);
        }
      } {
        //System.out.println(s.substring(i,i+t.length()));
        if(min>helper(s.substring(i,i+t.length()),t)){
          min=helper(s.substring(i,i+t.length()),t);
        }
      } if(min>helper(s.substring(i,i+t.length()),t)){
          min=helper(s.substring(i,i+t.length()),t);
        } min>helper(s.substring(i,i+t.length()),t) min helper(s.substring(i,i+t.length()),t) helper s.substring(i,i+t.length()) s.substring s i i+t.length() i t.length() t.length t t {
          min=helper(s.substring(i,i+t.length()),t);
        } min=helper(s.substring(i,i+t.length()),t) min helper(s.substring(i,i+t.length()),t) helper s.substring(i,i+t.length()) s.substring s i i+t.length() i t.length() t.length t t System.out.println(min) System.out.println System.out System System.out min String[] args args public static int helper(String s1, String s2){
    int count=0;
    for(int i=0;i<s1.length();i++){
      if(s1.charAt(i)!=s2.charAt(i)){
        count++;
      }
    }
    return count;
  } helper {
    int count=0;
    for(int i=0;i<s1.length();i++){
      if(s1.charAt(i)!=s2.charAt(i)){
        count++;
      }
    }
    return count;
  } int count=0; count 0 for(int i=0;i<s1.length();i++){
      if(s1.charAt(i)!=s2.charAt(i)){
        count++;
      }
    } int i=0; int i=0; i 0 i<s1.length() i s1.length() s1.length s1 i++ i++ i {
      if(s1.charAt(i)!=s2.charAt(i)){
        count++;
      }
    } {
      if(s1.charAt(i)!=s2.charAt(i)){
        count++;
      }
    } if(s1.charAt(i)!=s2.charAt(i)){
        count++;
      } s1.charAt(i)!=s2.charAt(i) s1.charAt(i) s1.charAt s1 i s2.charAt(i) s2.charAt s2 i {
        count++;
      } count++ count return count; count String s1 s1 String s2 s2 public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    if(s.indexOf(t)!=-1){
      System.out.println(0);
    }
    else{
      int min=Integer.MAX_VALUE;
      for(int i=0;i<=s.length()-t.length();i++){
        //System.out.println(s.substring(i,i+t.length()));
        if(min>helper(s.substring(i,i+t.length()),t)){
          min=helper(s.substring(i,i+t.length()),t);
        }
      }
      System.out.println(min);
    }
  }
  public static int helper(String s1, String s2){
    int count=0;
    for(int i=0;i<s1.length();i++){
      if(s1.charAt(i)!=s2.charAt(i)){
        count++;
      }
    }
    return count;
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    if(s.indexOf(t)!=-1){
      System.out.println(0);
    }
    else{
      int min=Integer.MAX_VALUE;
      for(int i=0;i<=s.length()-t.length();i++){
        //System.out.println(s.substring(i,i+t.length()));
        if(min>helper(s.substring(i,i+t.length()),t)){
          min=helper(s.substring(i,i+t.length()),t);
        }
      }
      System.out.println(min);
    }
  }
  public static int helper(String s1, String s2){
    int count=0;
    for(int i=0;i<s1.length();i++){
      if(s1.charAt(i)!=s2.charAt(i)){
        count++;
      }
    }
    return count;
  }
} 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();
    if(s.indexOf(t)!=-1){
      System.out.println(0);
    }
    else{
      int min=Integer.MAX_VALUE;
      for(int i=0;i<=s.length()-t.length();i++){
        //System.out.println(s.substring(i,i+t.length()));
        if(min>helper(s.substring(i,i+t.length()),t)){
          min=helper(s.substring(i,i+t.length()),t);
        }
      }
      System.out.println(min);
    }
  }
  public static int helper(String s1, String s2){
    int count=0;
    for(int i=0;i<s1.length();i++){
      if(s1.charAt(i)!=s2.charAt(i)){
        count++;
      }
    }
    return count;
  }
}