import java.util.Scanner;

class Main {

  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    String S = s.next();
    String T = s.next();
    System.out.println(changesRequired(S, T));
    s.close();
  }

  private static Integer changesRequired(String S, String T) {
    int answer = T.length();
    for (int i = 0; i <= S.length() - T.length(); i++) {
      int changesRequired = 0;
      for (int j = 0; j < T.length(); j++) {
        if (S.charAt(i + j) != T.charAt(j)) {
          changesRequired++;
        }
      }
      answer = Math.min(answer, changesRequired);
    }
    return answer;
  }
} import java.util.Scanner; Scanner java.util class Main {

  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    String S = s.next();
    String T = s.next();
    System.out.println(changesRequired(S, T));
    s.close();
  }

  private static Integer changesRequired(String S, String T) {
    int answer = T.length();
    for (int i = 0; i <= S.length() - T.length(); i++) {
      int changesRequired = 0;
      for (int j = 0; j < T.length(); j++) {
        if (S.charAt(i + j) != T.charAt(j)) {
          changesRequired++;
        }
      }
      answer = Math.min(answer, changesRequired);
    }
    return answer;
  }
} Main public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    String S = s.next();
    String T = s.next();
    System.out.println(changesRequired(S, T));
    s.close();
  } main {
    Scanner s = new Scanner(System.in);
    String S = s.next();
    String T = s.next();
    System.out.println(changesRequired(S, T));
    s.close();
  } Scanner s = new Scanner(System.in); s new Scanner(System.in) String S = s.next(); S s.next() s.next s String T = s.next(); T s.next() s.next s System.out.println(changesRequired(S, T)) System.out.println System.out System System.out changesRequired(S, T) changesRequired S T s.close() s.close s String[] args args private static Integer changesRequired(String S, String T) {
    int answer = T.length();
    for (int i = 0; i <= S.length() - T.length(); i++) {
      int changesRequired = 0;
      for (int j = 0; j < T.length(); j++) {
        if (S.charAt(i + j) != T.charAt(j)) {
          changesRequired++;
        }
      }
      answer = Math.min(answer, changesRequired);
    }
    return answer;
  } changesRequired {
    int answer = T.length();
    for (int i = 0; i <= S.length() - T.length(); i++) {
      int changesRequired = 0;
      for (int j = 0; j < T.length(); j++) {
        if (S.charAt(i + j) != T.charAt(j)) {
          changesRequired++;
        }
      }
      answer = Math.min(answer, changesRequired);
    }
    return answer;
  } int answer = T.length(); answer T.length() T.length T for (int i = 0; i <= S.length() - T.length(); i++) {
      int changesRequired = 0;
      for (int j = 0; j < T.length(); j++) {
        if (S.charAt(i + j) != T.charAt(j)) {
          changesRequired++;
        }
      }
      answer = Math.min(answer, changesRequired);
    } 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 changesRequired = 0;
      for (int j = 0; j < T.length(); j++) {
        if (S.charAt(i + j) != T.charAt(j)) {
          changesRequired++;
        }
      }
      answer = Math.min(answer, changesRequired);
    } {
      int changesRequired = 0;
      for (int j = 0; j < T.length(); j++) {
        if (S.charAt(i + j) != T.charAt(j)) {
          changesRequired++;
        }
      }
      answer = Math.min(answer, changesRequired);
    } int changesRequired = 0; changesRequired 0 for (int j = 0; j < T.length(); j++) {
        if (S.charAt(i + j) != T.charAt(j)) {
          changesRequired++;
        }
      } int j = 0; int j = 0; j 0 j < T.length() j T.length() T.length T j++ j++ j {
        if (S.charAt(i + j) != T.charAt(j)) {
          changesRequired++;
        }
      } {
        if (S.charAt(i + j) != T.charAt(j)) {
          changesRequired++;
        }
      } if (S.charAt(i + j) != T.charAt(j)) {
          changesRequired++;
        } 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 {
          changesRequired++;
        } changesRequired++ changesRequired answer = Math.min(answer, changesRequired) answer Math.min(answer, changesRequired) Math.min Math answer changesRequired return answer; answer String S S String T T
import java.util.Scanner;

class Main {

  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    String S = s.next();
    String T = s.next();
    System.out.println(changesRequired(S, T));
    s.close();
  }

  private static Integer changesRequired(String S, String T) {
    int answer = T.length();
    for (int i = 0; i <= S.length() - T.length(); i++) {
      int changesRequired = 0;
      for (int j = 0; j < T.length(); j++) {
        if (S.charAt(i + j) != T.charAt(j)) {
          changesRequired++;
        }
      }
      answer = Math.min(answer, changesRequired);
    }
    return answer;
  }
}
