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();
    int maxSame = 0;
    for (int i = 0; i < s.length()-t.length()+1; i++) {
      String sPart = s.substring(i, i+t.length());
      int count = 0;
      for (int j = 0; j < t.length(); j++) {
        if (sPart.charAt(j) == t.charAt(j)) count++;
      }
      maxSame = Math.max(maxSame, count);
    }
    System.out.println(t.length() - maxSame);
  }
} 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();
    int maxSame = 0;
    for (int i = 0; i < s.length()-t.length()+1; i++) {
      String sPart = s.substring(i, i+t.length());
      int count = 0;
      for (int j = 0; j < t.length(); j++) {
        if (sPart.charAt(j) == t.charAt(j)) count++;
      }
      maxSame = Math.max(maxSame, count);
    }
    System.out.println(t.length() - maxSame);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int maxSame = 0;
    for (int i = 0; i < s.length()-t.length()+1; i++) {
      String sPart = s.substring(i, i+t.length());
      int count = 0;
      for (int j = 0; j < t.length(); j++) {
        if (sPart.charAt(j) == t.charAt(j)) count++;
      }
      maxSame = Math.max(maxSame, count);
    }
    System.out.println(t.length() - maxSame);
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int maxSame = 0;
    for (int i = 0; i < s.length()-t.length()+1; i++) {
      String sPart = s.substring(i, i+t.length());
      int count = 0;
      for (int j = 0; j < t.length(); j++) {
        if (sPart.charAt(j) == t.charAt(j)) count++;
      }
      maxSame = Math.max(maxSame, count);
    }
    System.out.println(t.length() - maxSame);
  } 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 int maxSame = 0; maxSame 0 for (int i = 0; i < s.length()-t.length()+1; i++) {
      String sPart = s.substring(i, i+t.length());
      int count = 0;
      for (int j = 0; j < t.length(); j++) {
        if (sPart.charAt(j) == t.charAt(j)) count++;
      }
      maxSame = Math.max(maxSame, 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 sPart = s.substring(i, i+t.length());
      int count = 0;
      for (int j = 0; j < t.length(); j++) {
        if (sPart.charAt(j) == t.charAt(j)) count++;
      }
      maxSame = Math.max(maxSame, count);
    } {
      String sPart = s.substring(i, i+t.length());
      int count = 0;
      for (int j = 0; j < t.length(); j++) {
        if (sPart.charAt(j) == t.charAt(j)) count++;
      }
      maxSame = Math.max(maxSame, count);
    } String sPart = s.substring(i, i+t.length()); sPart 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 (sPart.charAt(j) == t.charAt(j)) count++;
      } int j = 0; int j = 0; j 0 j < t.length() j t.length() t.length t j++ j++ j {
        if (sPart.charAt(j) == t.charAt(j)) count++;
      } {
        if (sPart.charAt(j) == t.charAt(j)) count++;
      } if (sPart.charAt(j) == t.charAt(j)) count++; sPart.charAt(j) == t.charAt(j) sPart.charAt(j) sPart.charAt sPart j t.charAt(j) t.charAt t j count++ count maxSame = Math.max(maxSame, count) maxSame Math.max(maxSame, count) Math.max Math maxSame count System.out.println(t.length() - maxSame) System.out.println System.out System System.out t.length() - maxSame t.length() t.length t maxSame 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();
    int maxSame = 0;
    for (int i = 0; i < s.length()-t.length()+1; i++) {
      String sPart = s.substring(i, i+t.length());
      int count = 0;
      for (int j = 0; j < t.length(); j++) {
        if (sPart.charAt(j) == t.charAt(j)) count++;
      }
      maxSame = Math.max(maxSame, count);
    }
    System.out.println(t.length() - maxSame);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int maxSame = 0;
    for (int i = 0; i < s.length()-t.length()+1; i++) {
      String sPart = s.substring(i, i+t.length());
      int count = 0;
      for (int j = 0; j < t.length(); j++) {
        if (sPart.charAt(j) == t.charAt(j)) count++;
      }
      maxSame = Math.max(maxSame, count);
    }
    System.out.println(t.length() - maxSame);
  }
} 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();
    int maxSame = 0;
    for (int i = 0; i < s.length()-t.length()+1; i++) {
      String sPart = s.substring(i, i+t.length());
      int count = 0;
      for (int j = 0; j < t.length(); j++) {
        if (sPart.charAt(j) == t.charAt(j)) count++;
      }
      maxSame = Math.max(maxSame, count);
    }
    System.out.println(t.length() - maxSame);
  }
}
