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

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String s = scan.next();
    String t = scan.next();

    int sLen = s.length();
    int tLen = t.length();
    int min = 1001;

    for (int i = 0; i <= sLen - tLen; i++) {
      int diff;
      try {
        // System.out.println(s.substring(j-i, j+tLen-i) + " vs " + t);
        diff = calculateDiff(s.substring(i, i+tLen), t);
        // System.out.println("diff : " + diff);
      } catch (StringIndexOutOfBoundsException e) {
        continue;
      }
      if (min > diff) {
        min = diff;
      }
    }
    if (min == 1001) {
      min = tLen;
    }

    PrintWriter out = new PrintWriter(System.out);
    out.println(min);
    out.flush();
  }

  public static int calculateDiff(String a, String b) {
    int count = 0;
    for (int i = 0; i < b.length(); i++) {
      if (!a.substring(i, i+1).equals(b.substring(i, i+1))) {
        count++;
      }
    }
    return count;
  }
} import java.util.*; util.* java import java.io.*; io.* java import java.lang.*; lang.* java public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String s = scan.next();
    String t = scan.next();

    int sLen = s.length();
    int tLen = t.length();
    int min = 1001;

    for (int i = 0; i <= sLen - tLen; i++) {
      int diff;
      try {
        // System.out.println(s.substring(j-i, j+tLen-i) + " vs " + t);
        diff = calculateDiff(s.substring(i, i+tLen), t);
        // System.out.println("diff : " + diff);
      } catch (StringIndexOutOfBoundsException e) {
        continue;
      }
      if (min > diff) {
        min = diff;
      }
    }
    if (min == 1001) {
      min = tLen;
    }

    PrintWriter out = new PrintWriter(System.out);
    out.println(min);
    out.flush();
  }

  public static int calculateDiff(String a, String b) {
    int count = 0;
    for (int i = 0; i < b.length(); i++) {
      if (!a.substring(i, i+1).equals(b.substring(i, i+1))) {
        count++;
      }
    }
    return count;
  }
} Main public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String s = scan.next();
    String t = scan.next();

    int sLen = s.length();
    int tLen = t.length();
    int min = 1001;

    for (int i = 0; i <= sLen - tLen; i++) {
      int diff;
      try {
        // System.out.println(s.substring(j-i, j+tLen-i) + " vs " + t);
        diff = calculateDiff(s.substring(i, i+tLen), t);
        // System.out.println("diff : " + diff);
      } catch (StringIndexOutOfBoundsException e) {
        continue;
      }
      if (min > diff) {
        min = diff;
      }
    }
    if (min == 1001) {
      min = tLen;
    }

    PrintWriter out = new PrintWriter(System.out);
    out.println(min);
    out.flush();
  } main {
    Scanner scan = new Scanner(System.in);
    String s = scan.next();
    String t = scan.next();

    int sLen = s.length();
    int tLen = t.length();
    int min = 1001;

    for (int i = 0; i <= sLen - tLen; i++) {
      int diff;
      try {
        // System.out.println(s.substring(j-i, j+tLen-i) + " vs " + t);
        diff = calculateDiff(s.substring(i, i+tLen), t);
        // System.out.println("diff : " + diff);
      } catch (StringIndexOutOfBoundsException e) {
        continue;
      }
      if (min > diff) {
        min = diff;
      }
    }
    if (min == 1001) {
      min = tLen;
    }

    PrintWriter out = new PrintWriter(System.out);
    out.println(min);
    out.flush();
  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan String t = scan.next(); t scan.next() scan.next scan int sLen = s.length(); sLen s.length() s.length s int tLen = t.length(); tLen t.length() t.length t int min = 1001; min 1001 for (int i = 0; i <= sLen - tLen; i++) {
      int diff;
      try {
        // System.out.println(s.substring(j-i, j+tLen-i) + " vs " + t);
        diff = calculateDiff(s.substring(i, i+tLen), t);
        // System.out.println("diff : " + diff);
      } catch (StringIndexOutOfBoundsException e) {
        continue;
      }
      if (min > diff) {
        min = diff;
      }
    } int i = 0; int i = 0; i 0 i <= sLen - tLen i sLen - tLen sLen tLen i++ i++ i {
      int diff;
      try {
        // System.out.println(s.substring(j-i, j+tLen-i) + " vs " + t);
        diff = calculateDiff(s.substring(i, i+tLen), t);
        // System.out.println("diff : " + diff);
      } catch (StringIndexOutOfBoundsException e) {
        continue;
      }
      if (min > diff) {
        min = diff;
      }
    } {
      int diff;
      try {
        // System.out.println(s.substring(j-i, j+tLen-i) + " vs " + t);
        diff = calculateDiff(s.substring(i, i+tLen), t);
        // System.out.println("diff : " + diff);
      } catch (StringIndexOutOfBoundsException e) {
        continue;
      }
      if (min > diff) {
        min = diff;
      }
    } int diff; diff try {
        // System.out.println(s.substring(j-i, j+tLen-i) + " vs " + t);
        diff = calculateDiff(s.substring(i, i+tLen), t);
        // System.out.println("diff : " + diff);
      } catch (StringIndexOutOfBoundsException e) {
        continue;
      } catch (StringIndexOutOfBoundsException e) {
        continue;
      } StringIndexOutOfBoundsException e {
        continue;
      } continue; {
        // System.out.println(s.substring(j-i, j+tLen-i) + " vs " + t);
        diff = calculateDiff(s.substring(i, i+tLen), t);
        // System.out.println("diff : " + diff);
      } diff = calculateDiff(s.substring(i, i+tLen), t) diff calculateDiff(s.substring(i, i+tLen), t) calculateDiff s.substring(i, i+tLen) s.substring s i i+tLen i tLen t if (min > diff) {
        min = diff;
      } min > diff min diff {
        min = diff;
      } min = diff min diff if (min == 1001) {
      min = tLen;
    } min == 1001 min 1001 {
      min = tLen;
    } min = tLen min tLen PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) out.println(min) out.println out min out.flush() out.flush out String[] args args public static int calculateDiff(String a, String b) {
    int count = 0;
    for (int i = 0; i < b.length(); i++) {
      if (!a.substring(i, i+1).equals(b.substring(i, i+1))) {
        count++;
      }
    }
    return count;
  } calculateDiff {
    int count = 0;
    for (int i = 0; i < b.length(); i++) {
      if (!a.substring(i, i+1).equals(b.substring(i, i+1))) {
        count++;
      }
    }
    return count;
  } int count = 0; count 0 for (int i = 0; i < b.length(); i++) {
      if (!a.substring(i, i+1).equals(b.substring(i, i+1))) {
        count++;
      }
    } int i = 0; int i = 0; i 0 i < b.length() i b.length() b.length b i++ i++ i {
      if (!a.substring(i, i+1).equals(b.substring(i, i+1))) {
        count++;
      }
    } {
      if (!a.substring(i, i+1).equals(b.substring(i, i+1))) {
        count++;
      }
    } if (!a.substring(i, i+1).equals(b.substring(i, i+1))) {
        count++;
      } !a.substring(i, i+1).equals(b.substring(i, i+1)) a.substring(i, i+1).equals(b.substring(i, i+1)) a.substring(i, i+1).equals a.substring(i, i+1) a.substring a i i+1 i 1 b.substring(i, i+1) b.substring b i i+1 i 1 {
        count++;
      } count++ count return count; count String a a String b b public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String s = scan.next();
    String t = scan.next();

    int sLen = s.length();
    int tLen = t.length();
    int min = 1001;

    for (int i = 0; i <= sLen - tLen; i++) {
      int diff;
      try {
        // System.out.println(s.substring(j-i, j+tLen-i) + " vs " + t);
        diff = calculateDiff(s.substring(i, i+tLen), t);
        // System.out.println("diff : " + diff);
      } catch (StringIndexOutOfBoundsException e) {
        continue;
      }
      if (min > diff) {
        min = diff;
      }
    }
    if (min == 1001) {
      min = tLen;
    }

    PrintWriter out = new PrintWriter(System.out);
    out.println(min);
    out.flush();
  }

  public static int calculateDiff(String a, String b) {
    int count = 0;
    for (int i = 0; i < b.length(); i++) {
      if (!a.substring(i, i+1).equals(b.substring(i, i+1))) {
        count++;
      }
    }
    return count;
  }
} public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String s = scan.next();
    String t = scan.next();

    int sLen = s.length();
    int tLen = t.length();
    int min = 1001;

    for (int i = 0; i <= sLen - tLen; i++) {
      int diff;
      try {
        // System.out.println(s.substring(j-i, j+tLen-i) + " vs " + t);
        diff = calculateDiff(s.substring(i, i+tLen), t);
        // System.out.println("diff : " + diff);
      } catch (StringIndexOutOfBoundsException e) {
        continue;
      }
      if (min > diff) {
        min = diff;
      }
    }
    if (min == 1001) {
      min = tLen;
    }

    PrintWriter out = new PrintWriter(System.out);
    out.println(min);
    out.flush();
  }

  public static int calculateDiff(String a, String b) {
    int count = 0;
    for (int i = 0; i < b.length(); i++) {
      if (!a.substring(i, i+1).equals(b.substring(i, i+1))) {
        count++;
      }
    }
    return count;
  }
} Main
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String s = scan.next();
    String t = scan.next();

    int sLen = s.length();
    int tLen = t.length();
    int min = 1001;

    for (int i = 0; i <= sLen - tLen; i++) {
      int diff;
      try {
        // System.out.println(s.substring(j-i, j+tLen-i) + " vs " + t);
        diff = calculateDiff(s.substring(i, i+tLen), t);
        // System.out.println("diff : " + diff);
      } catch (StringIndexOutOfBoundsException e) {
        continue;
      }
      if (min > diff) {
        min = diff;
      }
    }
    if (min == 1001) {
      min = tLen;
    }

    PrintWriter out = new PrintWriter(System.out);
    out.println(min);
    out.flush();
  }

  public static int calculateDiff(String a, String b) {
    int count = 0;
    for (int i = 0; i < b.length(); i++) {
      if (!a.substring(i, i+1).equals(b.substring(i, i+1))) {
        count++;
      }
    }
    return count;
  }
}
