import java.io.*;
import java.util.*;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    String S = in.readLine();
    String T = in.readLine();

    System.out.println(solve(S, T));

    in.close();
  }

  private static int solve(String S, String T) {
    int maxNumCommonChars = 0;

    for (int i = 0; i + T.length() <= S.length(); ++i) {
      maxNumCommonChars = Math.max(maxNumCommonChars, getNumCommonChars(S, T, i));
    }

    return T.length() - maxNumCommonChars;
  }

  private static int getNumCommonChars(String S, String T, int start) {
    int numCommonChars = 0;

    for (int i = 0; i < T.length(); ++i) {
      if (S.charAt(start + i) == T.charAt(i)) {
        numCommonChars++;
      }
    }

    return numCommonChars;
  }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    String S = in.readLine();
    String T = in.readLine();

    System.out.println(solve(S, T));

    in.close();
  }

  private static int solve(String S, String T) {
    int maxNumCommonChars = 0;

    for (int i = 0; i + T.length() <= S.length(); ++i) {
      maxNumCommonChars = Math.max(maxNumCommonChars, getNumCommonChars(S, T, i));
    }

    return T.length() - maxNumCommonChars;
  }

  private static int getNumCommonChars(String S, String T, int start) {
    int numCommonChars = 0;

    for (int i = 0; i < T.length(); ++i) {
      if (S.charAt(start + i) == T.charAt(i)) {
        numCommonChars++;
      }
    }

    return numCommonChars;
  }
} Main public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    String S = in.readLine();
    String T = in.readLine();

    System.out.println(solve(S, T));

    in.close();
  } main {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    String S = in.readLine();
    String T = in.readLine();

    System.out.println(solve(S, T));

    in.close();
  } BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) String S = in.readLine(); S in.readLine() in.readLine in String T = in.readLine(); T in.readLine() in.readLine in System.out.println(solve(S, T)) System.out.println System.out System System.out solve(S, T) solve S T in.close() in.close in String[] args args private static int solve(String S, String T) {
    int maxNumCommonChars = 0;

    for (int i = 0; i + T.length() <= S.length(); ++i) {
      maxNumCommonChars = Math.max(maxNumCommonChars, getNumCommonChars(S, T, i));
    }

    return T.length() - maxNumCommonChars;
  } solve {
    int maxNumCommonChars = 0;

    for (int i = 0; i + T.length() <= S.length(); ++i) {
      maxNumCommonChars = Math.max(maxNumCommonChars, getNumCommonChars(S, T, i));
    }

    return T.length() - maxNumCommonChars;
  } int maxNumCommonChars = 0; maxNumCommonChars 0 for (int i = 0; i + T.length() <= S.length(); ++i) {
      maxNumCommonChars = Math.max(maxNumCommonChars, getNumCommonChars(S, T, i));
    } int i = 0; int i = 0; i 0 i + T.length() <= S.length() i + T.length() i T.length() T.length T S.length() S.length S ++i ++i i {
      maxNumCommonChars = Math.max(maxNumCommonChars, getNumCommonChars(S, T, i));
    } {
      maxNumCommonChars = Math.max(maxNumCommonChars, getNumCommonChars(S, T, i));
    } maxNumCommonChars = Math.max(maxNumCommonChars, getNumCommonChars(S, T, i)) maxNumCommonChars Math.max(maxNumCommonChars, getNumCommonChars(S, T, i)) Math.max Math maxNumCommonChars getNumCommonChars(S, T, i) getNumCommonChars S T i return T.length() - maxNumCommonChars; T.length() - maxNumCommonChars T.length() T.length T maxNumCommonChars String S S String T T private static int getNumCommonChars(String S, String T, int start) {
    int numCommonChars = 0;

    for (int i = 0; i < T.length(); ++i) {
      if (S.charAt(start + i) == T.charAt(i)) {
        numCommonChars++;
      }
    }

    return numCommonChars;
  } getNumCommonChars {
    int numCommonChars = 0;

    for (int i = 0; i < T.length(); ++i) {
      if (S.charAt(start + i) == T.charAt(i)) {
        numCommonChars++;
      }
    }

    return numCommonChars;
  } int numCommonChars = 0; numCommonChars 0 for (int i = 0; i < T.length(); ++i) {
      if (S.charAt(start + i) == T.charAt(i)) {
        numCommonChars++;
      }
    } int i = 0; int i = 0; i 0 i < T.length() i T.length() T.length T ++i ++i i {
      if (S.charAt(start + i) == T.charAt(i)) {
        numCommonChars++;
      }
    } {
      if (S.charAt(start + i) == T.charAt(i)) {
        numCommonChars++;
      }
    } if (S.charAt(start + i) == T.charAt(i)) {
        numCommonChars++;
      } S.charAt(start + i) == T.charAt(i) S.charAt(start + i) S.charAt S start + i start i T.charAt(i) T.charAt T i {
        numCommonChars++;
      } numCommonChars++ numCommonChars return numCommonChars; numCommonChars String S S String T T int start start public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    String S = in.readLine();
    String T = in.readLine();

    System.out.println(solve(S, T));

    in.close();
  }

  private static int solve(String S, String T) {
    int maxNumCommonChars = 0;

    for (int i = 0; i + T.length() <= S.length(); ++i) {
      maxNumCommonChars = Math.max(maxNumCommonChars, getNumCommonChars(S, T, i));
    }

    return T.length() - maxNumCommonChars;
  }

  private static int getNumCommonChars(String S, String T, int start) {
    int numCommonChars = 0;

    for (int i = 0; i < T.length(); ++i) {
      if (S.charAt(start + i) == T.charAt(i)) {
        numCommonChars++;
      }
    }

    return numCommonChars;
  }
} public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    String S = in.readLine();
    String T = in.readLine();

    System.out.println(solve(S, T));

    in.close();
  }

  private static int solve(String S, String T) {
    int maxNumCommonChars = 0;

    for (int i = 0; i + T.length() <= S.length(); ++i) {
      maxNumCommonChars = Math.max(maxNumCommonChars, getNumCommonChars(S, T, i));
    }

    return T.length() - maxNumCommonChars;
  }

  private static int getNumCommonChars(String S, String T, int start) {
    int numCommonChars = 0;

    for (int i = 0; i < T.length(); ++i) {
      if (S.charAt(start + i) == T.charAt(i)) {
        numCommonChars++;
      }
    }

    return numCommonChars;
  }
} Main
import java.io.*;
import java.util.*;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    String S = in.readLine();
    String T = in.readLine();

    System.out.println(solve(S, T));

    in.close();
  }

  private static int solve(String S, String T) {
    int maxNumCommonChars = 0;

    for (int i = 0; i + T.length() <= S.length(); ++i) {
      maxNumCommonChars = Math.max(maxNumCommonChars, getNumCommonChars(S, T, i));
    }

    return T.length() - maxNumCommonChars;
  }

  private static int getNumCommonChars(String S, String T, int start) {
    int numCommonChars = 0;

    for (int i = 0; i < T.length(); ++i) {
      if (S.charAt(start + i) == T.charAt(i)) {
        numCommonChars++;
      }
    }

    return numCommonChars;
  }
}