import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author MaxHeap
 */
public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    BSubstring solver = new BSubstring();
    solver.solve(1, in, out);
    out.close();
  }

  static class BSubstring {

    public void solve(int testNumber, InputReader in, PrintWriter out) {
      String s = in.next();
      String t = in.next();
      int ans = Integer.MAX_VALUE;
      for (int start = 0; start + t.length() <= s.length(); ++start) {
        int diff = 0;
        for (int i = 0; i < t.length(); ++i) {
          if (s.charAt(i + start) != t.charAt(i)) {
            ++diff;
          }
        }
        ans = Math.min(diff, ans);
      }
      out.println(ans);
    }

  }

  static class InputReader {

    private InputStream stream;
    private static final int DEFAULT_BUFFER_SIZE = 1 << 16;
    private static final int EOF = -1;
    private byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (this.numChars == EOF) {
        throw new UnknownError();
      } else {
        if (this.curChar >= this.numChars) {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return EOF;
          }
        }

        return this.buf[this.curChar++];
      }
    }

    public String next() {
      int c;
      while (isSpaceChar(c = this.read())) {
      }

      StringBuilder result = new StringBuilder();
      result.appendCodePoint(c);

      while (!isSpaceChar(c = this.read())) {
        result.appendCodePoint(c);
      }

      return result.toString();
    }

    public static boolean isSpaceChar(int c) {
      return c == 32 || c == 10 || c == 13 || c == 9 || c == EOF;
    }

  }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.io.IOException; IOException java.io import java.util.InputMismatchException; InputMismatchException java.util import java.io.InputStream; InputStream java.io public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    BSubstring solver = new BSubstring();
    solver.solve(1, in, out);
    out.close();
  }

  static class BSubstring {

    public void solve(int testNumber, InputReader in, PrintWriter out) {
      String s = in.next();
      String t = in.next();
      int ans = Integer.MAX_VALUE;
      for (int start = 0; start + t.length() <= s.length(); ++start) {
        int diff = 0;
        for (int i = 0; i < t.length(); ++i) {
          if (s.charAt(i + start) != t.charAt(i)) {
            ++diff;
          }
        }
        ans = Math.min(diff, ans);
      }
      out.println(ans);
    }

  }

  static class InputReader {

    private InputStream stream;
    private static final int DEFAULT_BUFFER_SIZE = 1 << 16;
    private static final int EOF = -1;
    private byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (this.numChars == EOF) {
        throw new UnknownError();
      } else {
        if (this.curChar >= this.numChars) {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return EOF;
          }
        }

        return this.buf[this.curChar++];
      }
    }

    public String next() {
      int c;
      while (isSpaceChar(c = this.read())) {
      }

      StringBuilder result = new StringBuilder();
      result.appendCodePoint(c);

      while (!isSpaceChar(c = this.read())) {
        result.appendCodePoint(c);
      }

      return result.toString();
    }

    public static boolean isSpaceChar(int c) {
      return c == 32 || c == 10 || c == 13 || c == 9 || c == EOF;
    }

  }
} Main public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    BSubstring solver = new BSubstring();
    solver.solve(1, in, out);
    out.close();
  } main {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    BSubstring solver = new BSubstring();
    solver.solve(1, in, out);
    out.close();
  } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out InputReader in = new InputReader(inputStream); in new InputReader(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) BSubstring solver = new BSubstring(); solver new BSubstring() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class BSubstring {

    public void solve(int testNumber, InputReader in, PrintWriter out) {
      String s = in.next();
      String t = in.next();
      int ans = Integer.MAX_VALUE;
      for (int start = 0; start + t.length() <= s.length(); ++start) {
        int diff = 0;
        for (int i = 0; i < t.length(); ++i) {
          if (s.charAt(i + start) != t.charAt(i)) {
            ++diff;
          }
        }
        ans = Math.min(diff, ans);
      }
      out.println(ans);
    }

  } BSubstring public void solve(int testNumber, InputReader in, PrintWriter out) {
      String s = in.next();
      String t = in.next();
      int ans = Integer.MAX_VALUE;
      for (int start = 0; start + t.length() <= s.length(); ++start) {
        int diff = 0;
        for (int i = 0; i < t.length(); ++i) {
          if (s.charAt(i + start) != t.charAt(i)) {
            ++diff;
          }
        }
        ans = Math.min(diff, ans);
      }
      out.println(ans);
    } solve {
      String s = in.next();
      String t = in.next();
      int ans = Integer.MAX_VALUE;
      for (int start = 0; start + t.length() <= s.length(); ++start) {
        int diff = 0;
        for (int i = 0; i < t.length(); ++i) {
          if (s.charAt(i + start) != t.charAt(i)) {
            ++diff;
          }
        }
        ans = Math.min(diff, ans);
      }
      out.println(ans);
    } String s = in.next(); s in.next() in.next in String t = in.next(); t in.next() in.next in int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int start = 0; start + t.length() <= s.length(); ++start) {
        int diff = 0;
        for (int i = 0; i < t.length(); ++i) {
          if (s.charAt(i + start) != t.charAt(i)) {
            ++diff;
          }
        }
        ans = Math.min(diff, ans);
      } int start = 0; int start = 0; start 0 start + t.length() <= s.length() start + t.length() start t.length() t.length t s.length() s.length s ++start ++start start {
        int diff = 0;
        for (int i = 0; i < t.length(); ++i) {
          if (s.charAt(i + start) != t.charAt(i)) {
            ++diff;
          }
        }
        ans = Math.min(diff, ans);
      } {
        int diff = 0;
        for (int i = 0; i < t.length(); ++i) {
          if (s.charAt(i + start) != t.charAt(i)) {
            ++diff;
          }
        }
        ans = Math.min(diff, ans);
      } int diff = 0; diff 0 for (int i = 0; i < t.length(); ++i) {
          if (s.charAt(i + start) != t.charAt(i)) {
            ++diff;
          }
        } int i = 0; int i = 0; i 0 i < t.length() i t.length() t.length t ++i ++i i {
          if (s.charAt(i + start) != t.charAt(i)) {
            ++diff;
          }
        } {
          if (s.charAt(i + start) != t.charAt(i)) {
            ++diff;
          }
        } if (s.charAt(i + start) != t.charAt(i)) {
            ++diff;
          } s.charAt(i + start) != t.charAt(i) s.charAt(i + start) s.charAt s i + start i start t.charAt(i) t.charAt t i {
            ++diff;
          } ++diff diff ans = Math.min(diff, ans) ans Math.min(diff, ans) Math.min Math diff ans out.println(ans) out.println out ans int testNumber testNumber InputReader in in PrintWriter out out static class InputReader {

    private InputStream stream;
    private static final int DEFAULT_BUFFER_SIZE = 1 << 16;
    private static final int EOF = -1;
    private byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (this.numChars == EOF) {
        throw new UnknownError();
      } else {
        if (this.curChar >= this.numChars) {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return EOF;
          }
        }

        return this.buf[this.curChar++];
      }
    }

    public String next() {
      int c;
      while (isSpaceChar(c = this.read())) {
      }

      StringBuilder result = new StringBuilder();
      result.appendCodePoint(c);

      while (!isSpaceChar(c = this.read())) {
        result.appendCodePoint(c);
      }

      return result.toString();
    }

    public static boolean isSpaceChar(int c) {
      return c == 32 || c == 10 || c == 13 || c == 9 || c == EOF;
    }

  } InputReader private InputStream stream; stream private static final int DEFAULT_BUFFER_SIZE = 1 << 16; DEFAULT_BUFFER_SIZE 1 << 16 1 16 private static final int EOF = -1; EOF -1 1 private byte[] buf = new byte[DEFAULT_BUFFER_SIZE]; buf new byte[DEFAULT_BUFFER_SIZE] DEFAULT_BUFFER_SIZE private int curChar; curChar private int numChars; numChars public InputReader(InputStream stream) {
      this.stream = stream;
    } InputReader {
      this.stream = stream;
    } this.stream = stream this.stream this this.stream stream InputStream stream stream public int read() {
      if (this.numChars == EOF) {
        throw new UnknownError();
      } else {
        if (this.curChar >= this.numChars) {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return EOF;
          }
        }

        return this.buf[this.curChar++];
      }
    } read {
      if (this.numChars == EOF) {
        throw new UnknownError();
      } else {
        if (this.curChar >= this.numChars) {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return EOF;
          }
        }

        return this.buf[this.curChar++];
      }
    } if (this.numChars == EOF) {
        throw new UnknownError();
      } else {
        if (this.curChar >= this.numChars) {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return EOF;
          }
        }

        return this.buf[this.curChar++];
      } this.numChars == EOF this.numChars this this.numChars EOF {
        throw new UnknownError();
      } throw new UnknownError(); new UnknownError() {
        if (this.curChar >= this.numChars) {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return EOF;
          }
        }

        return this.buf[this.curChar++];
      } if (this.curChar >= this.numChars) {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return EOF;
          }
        } this.curChar >= this.numChars this.curChar this this.curChar this.numChars this this.numChars {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return EOF;
          }
        } this.curChar = 0 this.curChar this this.curChar 0 try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          } catch (IOException ex) {
            throw new InputMismatchException();
          } IOException ex {
            throw new InputMismatchException();
          } throw new InputMismatchException(); new InputMismatchException() {
            this.numChars = this.stream.read(this.buf);
          } this.numChars = this.stream.read(this.buf) this.numChars this this.numChars this.stream.read(this.buf) this.stream.read this.stream this this.stream this.buf this this.buf if (this.numChars <= 0) {
            return EOF;
          } this.numChars <= 0 this.numChars this this.numChars 0 {
            return EOF;
          } return EOF; EOF return this.buf[this.curChar++]; this.buf[this.curChar++] this.buf this this.buf this.curChar++ this.curChar this this.curChar public String next() {
      int c;
      while (isSpaceChar(c = this.read())) {
      }

      StringBuilder result = new StringBuilder();
      result.appendCodePoint(c);

      while (!isSpaceChar(c = this.read())) {
        result.appendCodePoint(c);
      }

      return result.toString();
    } next {
      int c;
      while (isSpaceChar(c = this.read())) {
      }

      StringBuilder result = new StringBuilder();
      result.appendCodePoint(c);

      while (!isSpaceChar(c = this.read())) {
        result.appendCodePoint(c);
      }

      return result.toString();
    } int c; c while (isSpaceChar(c = this.read())) {
      } isSpaceChar(c = this.read()) isSpaceChar c = this.read() c this.read() this.read this {
      } StringBuilder result = new StringBuilder(); result new StringBuilder() result.appendCodePoint(c) result.appendCodePoint result c while (!isSpaceChar(c = this.read())) {
        result.appendCodePoint(c);
      } !isSpaceChar(c = this.read()) isSpaceChar(c = this.read()) isSpaceChar c = this.read() c this.read() this.read this {
        result.appendCodePoint(c);
      } result.appendCodePoint(c) result.appendCodePoint result c return result.toString(); result.toString() result.toString result public static boolean isSpaceChar(int c) {
      return c == 32 || c == 10 || c == 13 || c == 9 || c == EOF;
    } isSpaceChar {
      return c == 32 || c == 10 || c == 13 || c == 9 || c == EOF;
    } return c == 32 || c == 10 || c == 13 || c == 9 || c == EOF; c == 32 || c == 10 || c == 13 || c == 9 || c == EOF c == 9 c == 13 c == 32 || c == 10 || c == 13 || c == 9 || c == EOF c == 32 c 32 c == 10 c 10 c == 13 c 13 c == 9 c 9 c == EOF c EOF int c c public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    BSubstring solver = new BSubstring();
    solver.solve(1, in, out);
    out.close();
  }

  static class BSubstring {

    public void solve(int testNumber, InputReader in, PrintWriter out) {
      String s = in.next();
      String t = in.next();
      int ans = Integer.MAX_VALUE;
      for (int start = 0; start + t.length() <= s.length(); ++start) {
        int diff = 0;
        for (int i = 0; i < t.length(); ++i) {
          if (s.charAt(i + start) != t.charAt(i)) {
            ++diff;
          }
        }
        ans = Math.min(diff, ans);
      }
      out.println(ans);
    }

  }

  static class InputReader {

    private InputStream stream;
    private static final int DEFAULT_BUFFER_SIZE = 1 << 16;
    private static final int EOF = -1;
    private byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (this.numChars == EOF) {
        throw new UnknownError();
      } else {
        if (this.curChar >= this.numChars) {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return EOF;
          }
        }

        return this.buf[this.curChar++];
      }
    }

    public String next() {
      int c;
      while (isSpaceChar(c = this.read())) {
      }

      StringBuilder result = new StringBuilder();
      result.appendCodePoint(c);

      while (!isSpaceChar(c = this.read())) {
        result.appendCodePoint(c);
      }

      return result.toString();
    }

    public static boolean isSpaceChar(int c) {
      return c == 32 || c == 10 || c == 13 || c == 9 || c == EOF;
    }

  }
} public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    BSubstring solver = new BSubstring();
    solver.solve(1, in, out);
    out.close();
  }

  static class BSubstring {

    public void solve(int testNumber, InputReader in, PrintWriter out) {
      String s = in.next();
      String t = in.next();
      int ans = Integer.MAX_VALUE;
      for (int start = 0; start + t.length() <= s.length(); ++start) {
        int diff = 0;
        for (int i = 0; i < t.length(); ++i) {
          if (s.charAt(i + start) != t.charAt(i)) {
            ++diff;
          }
        }
        ans = Math.min(diff, ans);
      }
      out.println(ans);
    }

  }

  static class InputReader {

    private InputStream stream;
    private static final int DEFAULT_BUFFER_SIZE = 1 << 16;
    private static final int EOF = -1;
    private byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (this.numChars == EOF) {
        throw new UnknownError();
      } else {
        if (this.curChar >= this.numChars) {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return EOF;
          }
        }

        return this.buf[this.curChar++];
      }
    }

    public String next() {
      int c;
      while (isSpaceChar(c = this.read())) {
      }

      StringBuilder result = new StringBuilder();
      result.appendCodePoint(c);

      while (!isSpaceChar(c = this.read())) {
        result.appendCodePoint(c);
      }

      return result.toString();
    }

    public static boolean isSpaceChar(int c) {
      return c == 32 || c == 10 || c == 13 || c == 9 || c == EOF;
    }

  }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author MaxHeap
 */
public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    BSubstring solver = new BSubstring();
    solver.solve(1, in, out);
    out.close();
  }

  static class BSubstring {

    public void solve(int testNumber, InputReader in, PrintWriter out) {
      String s = in.next();
      String t = in.next();
      int ans = Integer.MAX_VALUE;
      for (int start = 0; start + t.length() <= s.length(); ++start) {
        int diff = 0;
        for (int i = 0; i < t.length(); ++i) {
          if (s.charAt(i + start) != t.charAt(i)) {
            ++diff;
          }
        }
        ans = Math.min(diff, ans);
      }
      out.println(ans);
    }

  }

  static class InputReader {

    private InputStream stream;
    private static final int DEFAULT_BUFFER_SIZE = 1 << 16;
    private static final int EOF = -1;
    private byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (this.numChars == EOF) {
        throw new UnknownError();
      } else {
        if (this.curChar >= this.numChars) {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return EOF;
          }
        }

        return this.buf[this.curChar++];
      }
    }

    public String next() {
      int c;
      while (isSpaceChar(c = this.read())) {
      }

      StringBuilder result = new StringBuilder();
      result.appendCodePoint(c);

      while (!isSpaceChar(c = this.read())) {
        result.appendCodePoint(c);
      }

      return result.toString();
    }

    public static boolean isSpaceChar(int c) {
      return c == 32 || c == 10 || c == 13 || c == 9 || c == EOF;
    }

  }
}

