import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    final Scanner sc = new Scanner(System.in);
    final String s = sc.nextLine();
    final String t = sc.nextLine();
    int min_diff = s.length();

    for (int i = 0; i <= (s.length() - t.length()); i++) {
      int j = 0;
      int diff = 0;
      while (j < t.length()) {
        if (s.charAt(i + j) != t.charAt(j)) {
          diff++;
        }
        j++;
      }

      if (min_diff > diff) {
        min_diff = diff;
      }
    }

    System.out.println(min_diff);
  }
} import java.util.Scanner; Scanner java.util class Main {
  public static void main(String[] args) {
    final Scanner sc = new Scanner(System.in);
    final String s = sc.nextLine();
    final String t = sc.nextLine();
    int min_diff = s.length();

    for (int i = 0; i <= (s.length() - t.length()); i++) {
      int j = 0;
      int diff = 0;
      while (j < t.length()) {
        if (s.charAt(i + j) != t.charAt(j)) {
          diff++;
        }
        j++;
      }

      if (min_diff > diff) {
        min_diff = diff;
      }
    }

    System.out.println(min_diff);
  }
} Main public static void main(String[] args) {
    final Scanner sc = new Scanner(System.in);
    final String s = sc.nextLine();
    final String t = sc.nextLine();
    int min_diff = s.length();

    for (int i = 0; i <= (s.length() - t.length()); i++) {
      int j = 0;
      int diff = 0;
      while (j < t.length()) {
        if (s.charAt(i + j) != t.charAt(j)) {
          diff++;
        }
        j++;
      }

      if (min_diff > diff) {
        min_diff = diff;
      }
    }

    System.out.println(min_diff);
  } main {
    final Scanner sc = new Scanner(System.in);
    final String s = sc.nextLine();
    final String t = sc.nextLine();
    int min_diff = s.length();

    for (int i = 0; i <= (s.length() - t.length()); i++) {
      int j = 0;
      int diff = 0;
      while (j < t.length()) {
        if (s.charAt(i + j) != t.charAt(j)) {
          diff++;
        }
        j++;
      }

      if (min_diff > diff) {
        min_diff = diff;
      }
    }

    System.out.println(min_diff);
  } final Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc final String t = sc.nextLine(); t sc.nextLine() sc.nextLine sc int min_diff = s.length(); min_diff s.length() s.length s for (int i = 0; i <= (s.length() - t.length()); i++) {
      int j = 0;
      int diff = 0;
      while (j < t.length()) {
        if (s.charAt(i + j) != t.charAt(j)) {
          diff++;
        }
        j++;
      }

      if (min_diff > diff) {
        min_diff = diff;
      }
    } 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 j = 0;
      int diff = 0;
      while (j < t.length()) {
        if (s.charAt(i + j) != t.charAt(j)) {
          diff++;
        }
        j++;
      }

      if (min_diff > diff) {
        min_diff = diff;
      }
    } {
      int j = 0;
      int diff = 0;
      while (j < t.length()) {
        if (s.charAt(i + j) != t.charAt(j)) {
          diff++;
        }
        j++;
      }

      if (min_diff > diff) {
        min_diff = diff;
      }
    } int j = 0; j 0 int diff = 0; diff 0 while (j < t.length()) {
        if (s.charAt(i + j) != t.charAt(j)) {
          diff++;
        }
        j++;
      } j < t.length() j t.length() t.length t {
        if (s.charAt(i + j) != t.charAt(j)) {
          diff++;
        }
        j++;
      } if (s.charAt(i + j) != t.charAt(j)) {
          diff++;
        } s.charAt(i + j) != t.charAt(j) s.charAt(i + j) s.charAt s i + j i j t.charAt(j) t.charAt t j {
          diff++;
        } diff++ diff j++ j if (min_diff > diff) {
        min_diff = diff;
      } min_diff > diff min_diff diff {
        min_diff = diff;
      } min_diff = diff min_diff diff System.out.println(min_diff) System.out.println System.out System System.out min_diff String[] args args
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    final Scanner sc = new Scanner(System.in);
    final String s = sc.nextLine();
    final String t = sc.nextLine();
    int min_diff = s.length();

    for (int i = 0; i <= (s.length() - t.length()); i++) {
      int j = 0;
      int diff = 0;
      while (j < t.length()) {
        if (s.charAt(i + j) != t.charAt(j)) {
          diff++;
        }
        j++;
      }

      if (min_diff > diff) {
        min_diff = diff;
      }
    }

    System.out.println(min_diff);
  }
}