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

/**
 * @author tutuz on 2020/08/30
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyInput in = new MyInput(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskX solver = new TaskX();
        solver.solve(1, in, out);
        out.close();
    }

    static int INF = 1 << 30;
    static long LINF = 1L << 55;
    static int MOD = 1000000007;
    static int[] mh4 = {0, -1, 1, 0};
    static int[] mw4 = {-1, 0, 0, 1};
    static int[] mh8 = {-1, -1, -1, 0, 0, 1, 1, 1};
    static int[] mw8 = {-1, 0, 1, -1, 1, -1, 0, 1};

    static class TaskX {

        public void solve(int testNumber, MyInput in, PrintWriter out) {
            char[] s = in.nextChars(), t = in.nextChars();
            int ans = INF;
            for (int i = 0; i <= s.length - t.length; i++) {
                int diff = 0;
                for (int j = 0; j < t.length; j++) {
                    if (s[i + j] != t[j]) diff++;
                }
                if (diff < ans) ans = diff;
            }
            out.println(ans);
        }
    }

    static class MyInput {
        private final BufferedReader in;
        private static int pos;
        private static int readLen;
        private static final char[] buffer = new char[1024 * 8];
        private static char[] str = new char[500 * 8 * 2];
        private static boolean[] isDigit = new boolean[256];
        private static boolean[] isSpace = new boolean[256];
        private static boolean[] isLineSep = new boolean[256];

        static {
            for (int i = 0; i < 10; i++) {
                isDigit['0' + i] = true;
            }
            isDigit['-'] = true;
            isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true;
            isLineSep['\r'] = isLineSep['\n'] = true;
        }

        public MyInput(InputStream is) {
            in = new BufferedReader(new InputStreamReader(is));
        }

        public int read() {
            if (pos >= readLen) {
                pos = 0;
                try {
                    readLen = in.read(buffer);
                } catch (IOException e) {
                    throw new RuntimeException();
                }
                if (readLen <= 0) {
                    throw new EndOfFileRuntimeException();
                }
            }
            return buffer[pos++];
        }

        public int nextInt() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            int i = 0;
            int ret = 0;
            if (str[0] == '-') {
                i = 1;
            }
            for (; i < len; i++)
                ret = ret * 10 + str[i] - '0';
            if (str[0] == '-') {
                ret = -ret;
            }
            return ret;
        }

        public long nextLong() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            int i = 0;
            long ret = 0;
            if (str[0] == '-') {
                i = 1;
            }
            for (; i < len; i++)
                ret = ret * 10 + str[i] - '0';
            if (str[0] == '-') {
                ret = -ret;
            }
            return ret;
        }

        public char nextChar() {
            while (true) {
                final int c = read();
                if (!isSpace[c]) {
                    return (char) c;
                }
            }
        }

        public String nextString() {
            return new String(nextChars());
        }

        public char[] nextChars() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            return Arrays.copyOf(str, len);
        }

        public char[][] next2DChars(int h, int w) {
            char[][] s = new char[h][w];
            for (int i = 0; i < h; i++) {
                s[i] = nextChars();
            }
            return s;
        }

        int reads(int len, boolean[] accept) {
            try {
                while (true) {
                    final int c = read();
                    if (accept[c]) {
                        break;
                    }
                    if (str.length == len) {
                        char[] rep = new char[str.length * 3 / 2];
                        System.arraycopy(str, 0, rep, 0, str.length);
                        str = rep;
                    }
                    str[len++] = (char) c;
                }
            } catch (EndOfFileRuntimeException e) {
            }
            return len;
        }

        public int[] nextIntArray(final int n) {
            final int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public int[] nextIntArray1Index(final int n) {
            final int[] res = new int[n + 1];
            for (int i = 1; i < n + 1; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public int[] nextIntArrayDec(final int n) {
            final int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt() - 1;
            }
            return res;
        }

        public long[] nextLongArray(final int n) {
            final long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long[] nextLongArray1Index(final int n) {
            final long[] res = new long[n + 1];
            for (int i = 1; i < n + 1; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long[] nextLongArrayDec(final int n) {
            final long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong() - 1;
            }
            return res;
        }

        public double nextDouble() {
            return Double.parseDouble(nextString());
        }

        public double[] nextDoubleArray(int n) {
            double[] res = new double[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextDouble();
            }
            return res;
        }

        static class EndOfFileRuntimeException extends RuntimeException {
        }

    }
} import java.io.*; io.* java import java.util.Arrays; Arrays java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyInput in = new MyInput(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskX solver = new TaskX();
        solver.solve(1, in, out);
        out.close();
    }

    static int INF = 1 << 30;
    static long LINF = 1L << 55;
    static int MOD = 1000000007;
    static int[] mh4 = {0, -1, 1, 0};
    static int[] mw4 = {-1, 0, 0, 1};
    static int[] mh8 = {-1, -1, -1, 0, 0, 1, 1, 1};
    static int[] mw8 = {-1, 0, 1, -1, 1, -1, 0, 1};

    static class TaskX {

        public void solve(int testNumber, MyInput in, PrintWriter out) {
            char[] s = in.nextChars(), t = in.nextChars();
            int ans = INF;
            for (int i = 0; i <= s.length - t.length; i++) {
                int diff = 0;
                for (int j = 0; j < t.length; j++) {
                    if (s[i + j] != t[j]) diff++;
                }
                if (diff < ans) ans = diff;
            }
            out.println(ans);
        }
    }

    static class MyInput {
        private final BufferedReader in;
        private static int pos;
        private static int readLen;
        private static final char[] buffer = new char[1024 * 8];
        private static char[] str = new char[500 * 8 * 2];
        private static boolean[] isDigit = new boolean[256];
        private static boolean[] isSpace = new boolean[256];
        private static boolean[] isLineSep = new boolean[256];

        static {
            for (int i = 0; i < 10; i++) {
                isDigit['0' + i] = true;
            }
            isDigit['-'] = true;
            isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true;
            isLineSep['\r'] = isLineSep['\n'] = true;
        }

        public MyInput(InputStream is) {
            in = new BufferedReader(new InputStreamReader(is));
        }

        public int read() {
            if (pos >= readLen) {
                pos = 0;
                try {
                    readLen = in.read(buffer);
                } catch (IOException e) {
                    throw new RuntimeException();
                }
                if (readLen <= 0) {
                    throw new EndOfFileRuntimeException();
                }
            }
            return buffer[pos++];
        }

        public int nextInt() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            int i = 0;
            int ret = 0;
            if (str[0] == '-') {
                i = 1;
            }
            for (; i < len; i++)
                ret = ret * 10 + str[i] - '0';
            if (str[0] == '-') {
                ret = -ret;
            }
            return ret;
        }

        public long nextLong() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            int i = 0;
            long ret = 0;
            if (str[0] == '-') {
                i = 1;
            }
            for (; i < len; i++)
                ret = ret * 10 + str[i] - '0';
            if (str[0] == '-') {
                ret = -ret;
            }
            return ret;
        }

        public char nextChar() {
            while (true) {
                final int c = read();
                if (!isSpace[c]) {
                    return (char) c;
                }
            }
        }

        public String nextString() {
            return new String(nextChars());
        }

        public char[] nextChars() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            return Arrays.copyOf(str, len);
        }

        public char[][] next2DChars(int h, int w) {
            char[][] s = new char[h][w];
            for (int i = 0; i < h; i++) {
                s[i] = nextChars();
            }
            return s;
        }

        int reads(int len, boolean[] accept) {
            try {
                while (true) {
                    final int c = read();
                    if (accept[c]) {
                        break;
                    }
                    if (str.length == len) {
                        char[] rep = new char[str.length * 3 / 2];
                        System.arraycopy(str, 0, rep, 0, str.length);
                        str = rep;
                    }
                    str[len++] = (char) c;
                }
            } catch (EndOfFileRuntimeException e) {
            }
            return len;
        }

        public int[] nextIntArray(final int n) {
            final int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public int[] nextIntArray1Index(final int n) {
            final int[] res = new int[n + 1];
            for (int i = 1; i < n + 1; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public int[] nextIntArrayDec(final int n) {
            final int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt() - 1;
            }
            return res;
        }

        public long[] nextLongArray(final int n) {
            final long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long[] nextLongArray1Index(final int n) {
            final long[] res = new long[n + 1];
            for (int i = 1; i < n + 1; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long[] nextLongArrayDec(final int n) {
            final long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong() - 1;
            }
            return res;
        }

        public double nextDouble() {
            return Double.parseDouble(nextString());
        }

        public double[] nextDoubleArray(int n) {
            double[] res = new double[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextDouble();
            }
            return res;
        }

        static class EndOfFileRuntimeException extends RuntimeException {
        }

    }
} Main static int INF = 1 << 30; INF 1 << 30 1 30 static long LINF = 1L << 55; LINF 1L << 55 1L 55 static int MOD = 1000000007; MOD 1000000007 static int[] mh4 = {0, -1, 1, 0}; mh4 {0, -1, 1, 0} 0 -1 1 1 0 static int[] mw4 = {-1, 0, 0, 1}; mw4 {-1, 0, 0, 1} -1 1 0 0 1 static int[] mh8 = {-1, -1, -1, 0, 0, 1, 1, 1}; mh8 {-1, -1, -1, 0, 0, 1, 1, 1} -1 1 -1 1 -1 1 0 0 1 1 1 static int[] mw8 = {-1, 0, 1, -1, 1, -1, 0, 1}; mw8 {-1, 0, 1, -1, 1, -1, 0, 1} -1 1 0 1 -1 1 1 -1 1 0 1 public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyInput in = new MyInput(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskX solver = new TaskX();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyInput in = new MyInput(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskX solver = new TaskX();
        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 MyInput in = new MyInput(inputStream); in new MyInput(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) TaskX solver = new TaskX(); solver new TaskX() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class TaskX {

        public void solve(int testNumber, MyInput in, PrintWriter out) {
            char[] s = in.nextChars(), t = in.nextChars();
            int ans = INF;
            for (int i = 0; i <= s.length - t.length; i++) {
                int diff = 0;
                for (int j = 0; j < t.length; j++) {
                    if (s[i + j] != t[j]) diff++;
                }
                if (diff < ans) ans = diff;
            }
            out.println(ans);
        }
    } TaskX public void solve(int testNumber, MyInput in, PrintWriter out) {
            char[] s = in.nextChars(), t = in.nextChars();
            int ans = INF;
            for (int i = 0; i <= s.length - t.length; i++) {
                int diff = 0;
                for (int j = 0; j < t.length; j++) {
                    if (s[i + j] != t[j]) diff++;
                }
                if (diff < ans) ans = diff;
            }
            out.println(ans);
        } solve {
            char[] s = in.nextChars(), t = in.nextChars();
            int ans = INF;
            for (int i = 0; i <= s.length - t.length; i++) {
                int diff = 0;
                for (int j = 0; j < t.length; j++) {
                    if (s[i + j] != t[j]) diff++;
                }
                if (diff < ans) ans = diff;
            }
            out.println(ans);
        } char[] s = in.nextChars() s in.nextChars() in.nextChars in t = in.nextChars(); t in.nextChars() in.nextChars in int ans = INF; ans INF for (int i = 0; i <= s.length - t.length; i++) {
                int diff = 0;
                for (int j = 0; j < t.length; j++) {
                    if (s[i + j] != t[j]) diff++;
                }
                if (diff < ans) ans = diff;
            } int i = 0; int i = 0; i 0 i <= s.length - t.length i s.length - t.length s.length s s.length t.length t t.length i++ i++ i {
                int diff = 0;
                for (int j = 0; j < t.length; j++) {
                    if (s[i + j] != t[j]) diff++;
                }
                if (diff < ans) ans = diff;
            } {
                int diff = 0;
                for (int j = 0; j < t.length; j++) {
                    if (s[i + j] != t[j]) diff++;
                }
                if (diff < ans) ans = diff;
            } int diff = 0; diff 0 for (int j = 0; j < t.length; j++) {
                    if (s[i + j] != t[j]) diff++;
                } int j = 0; int j = 0; j 0 j < t.length j t.length t t.length j++ j++ j {
                    if (s[i + j] != t[j]) diff++;
                } {
                    if (s[i + j] != t[j]) diff++;
                } if (s[i + j] != t[j]) diff++; s[i + j] != t[j] s[i + j] s i + j i j t[j] t j diff++ diff if (diff < ans) ans = diff; diff < ans diff ans ans = diff ans diff out.println(ans) out.println out ans int testNumber testNumber MyInput in in PrintWriter out out static class MyInput {
        private final BufferedReader in;
        private static int pos;
        private static int readLen;
        private static final char[] buffer = new char[1024 * 8];
        private static char[] str = new char[500 * 8 * 2];
        private static boolean[] isDigit = new boolean[256];
        private static boolean[] isSpace = new boolean[256];
        private static boolean[] isLineSep = new boolean[256];

        static {
            for (int i = 0; i < 10; i++) {
                isDigit['0' + i] = true;
            }
            isDigit['-'] = true;
            isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true;
            isLineSep['\r'] = isLineSep['\n'] = true;
        }

        public MyInput(InputStream is) {
            in = new BufferedReader(new InputStreamReader(is));
        }

        public int read() {
            if (pos >= readLen) {
                pos = 0;
                try {
                    readLen = in.read(buffer);
                } catch (IOException e) {
                    throw new RuntimeException();
                }
                if (readLen <= 0) {
                    throw new EndOfFileRuntimeException();
                }
            }
            return buffer[pos++];
        }

        public int nextInt() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            int i = 0;
            int ret = 0;
            if (str[0] == '-') {
                i = 1;
            }
            for (; i < len; i++)
                ret = ret * 10 + str[i] - '0';
            if (str[0] == '-') {
                ret = -ret;
            }
            return ret;
        }

        public long nextLong() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            int i = 0;
            long ret = 0;
            if (str[0] == '-') {
                i = 1;
            }
            for (; i < len; i++)
                ret = ret * 10 + str[i] - '0';
            if (str[0] == '-') {
                ret = -ret;
            }
            return ret;
        }

        public char nextChar() {
            while (true) {
                final int c = read();
                if (!isSpace[c]) {
                    return (char) c;
                }
            }
        }

        public String nextString() {
            return new String(nextChars());
        }

        public char[] nextChars() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            return Arrays.copyOf(str, len);
        }

        public char[][] next2DChars(int h, int w) {
            char[][] s = new char[h][w];
            for (int i = 0; i < h; i++) {
                s[i] = nextChars();
            }
            return s;
        }

        int reads(int len, boolean[] accept) {
            try {
                while (true) {
                    final int c = read();
                    if (accept[c]) {
                        break;
                    }
                    if (str.length == len) {
                        char[] rep = new char[str.length * 3 / 2];
                        System.arraycopy(str, 0, rep, 0, str.length);
                        str = rep;
                    }
                    str[len++] = (char) c;
                }
            } catch (EndOfFileRuntimeException e) {
            }
            return len;
        }

        public int[] nextIntArray(final int n) {
            final int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public int[] nextIntArray1Index(final int n) {
            final int[] res = new int[n + 1];
            for (int i = 1; i < n + 1; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public int[] nextIntArrayDec(final int n) {
            final int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt() - 1;
            }
            return res;
        }

        public long[] nextLongArray(final int n) {
            final long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long[] nextLongArray1Index(final int n) {
            final long[] res = new long[n + 1];
            for (int i = 1; i < n + 1; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long[] nextLongArrayDec(final int n) {
            final long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong() - 1;
            }
            return res;
        }

        public double nextDouble() {
            return Double.parseDouble(nextString());
        }

        public double[] nextDoubleArray(int n) {
            double[] res = new double[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextDouble();
            }
            return res;
        }

        static class EndOfFileRuntimeException extends RuntimeException {
        }

    } MyInput private final BufferedReader in; in private static int pos; pos private static int readLen; readLen private static final char[] buffer = new char[1024 * 8]; buffer new char[1024 * 8] 1024 * 8 1024 8 private static char[] str = new char[500 * 8 * 2]; str new char[500 * 8 * 2] 500 * 8 * 2 500 * 8 * 2 500 8 2 private static boolean[] isDigit = new boolean[256]; isDigit new boolean[256] 256 private static boolean[] isSpace = new boolean[256]; isSpace new boolean[256] 256 private static boolean[] isLineSep = new boolean[256]; isLineSep new boolean[256] 256 public MyInput(InputStream is) {
            in = new BufferedReader(new InputStreamReader(is));
        } MyInput {
            in = new BufferedReader(new InputStreamReader(is));
        } in = new BufferedReader(new InputStreamReader(is)) in new BufferedReader(new InputStreamReader(is)) InputStream is is public int read() {
            if (pos >= readLen) {
                pos = 0;
                try {
                    readLen = in.read(buffer);
                } catch (IOException e) {
                    throw new RuntimeException();
                }
                if (readLen <= 0) {
                    throw new EndOfFileRuntimeException();
                }
            }
            return buffer[pos++];
        } read {
            if (pos >= readLen) {
                pos = 0;
                try {
                    readLen = in.read(buffer);
                } catch (IOException e) {
                    throw new RuntimeException();
                }
                if (readLen <= 0) {
                    throw new EndOfFileRuntimeException();
                }
            }
            return buffer[pos++];
        } if (pos >= readLen) {
                pos = 0;
                try {
                    readLen = in.read(buffer);
                } catch (IOException e) {
                    throw new RuntimeException();
                }
                if (readLen <= 0) {
                    throw new EndOfFileRuntimeException();
                }
            } pos >= readLen pos readLen {
                pos = 0;
                try {
                    readLen = in.read(buffer);
                } catch (IOException e) {
                    throw new RuntimeException();
                }
                if (readLen <= 0) {
                    throw new EndOfFileRuntimeException();
                }
            } pos = 0 pos 0 try {
                    readLen = in.read(buffer);
                } catch (IOException e) {
                    throw new RuntimeException();
                } catch (IOException e) {
                    throw new RuntimeException();
                } IOException e {
                    throw new RuntimeException();
                } throw new RuntimeException(); new RuntimeException() {
                    readLen = in.read(buffer);
                } readLen = in.read(buffer) readLen in.read(buffer) in.read in buffer if (readLen <= 0) {
                    throw new EndOfFileRuntimeException();
                } readLen <= 0 readLen 0 {
                    throw new EndOfFileRuntimeException();
                } throw new EndOfFileRuntimeException(); new EndOfFileRuntimeException() return buffer[pos++]; buffer[pos++] buffer pos++ pos public int nextInt() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            int i = 0;
            int ret = 0;
            if (str[0] == '-') {
                i = 1;
            }
            for (; i < len; i++)
                ret = ret * 10 + str[i] - '0';
            if (str[0] == '-') {
                ret = -ret;
            }
            return ret;
        } nextInt {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            int i = 0;
            int ret = 0;
            if (str[0] == '-') {
                i = 1;
            }
            for (; i < len; i++)
                ret = ret * 10 + str[i] - '0';
            if (str[0] == '-') {
                ret = -ret;
            }
            return ret;
        } int len = 0; len 0 str[len++] = nextChar() str[len++] str len++ len nextChar() nextChar len = reads(len, isSpace) len reads(len, isSpace) reads len isSpace int i = 0; i 0 int ret = 0; ret 0 if (str[0] == '-') {
                i = 1;
            } str[0] == '-' str[0] str 0 '-' {
                i = 1;
            } i = 1 i 1 for (; i < len; i++)
                ret = ret * 10 + str[i] - '0'; ; i < len i len i++ i++ i ret = ret * 10 + str[i] - '0'; ret = ret * 10 + str[i] - '0' ret ret * 10 + str[i] - '0' ret * 10 + str[i] ret * 10 ret 10 str[i] str i '0' if (str[0] == '-') {
                ret = -ret;
            } str[0] == '-' str[0] str 0 '-' {
                ret = -ret;
            } ret = -ret ret -ret ret return ret; ret public long nextLong() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            int i = 0;
            long ret = 0;
            if (str[0] == '-') {
                i = 1;
            }
            for (; i < len; i++)
                ret = ret * 10 + str[i] - '0';
            if (str[0] == '-') {
                ret = -ret;
            }
            return ret;
        } nextLong {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            int i = 0;
            long ret = 0;
            if (str[0] == '-') {
                i = 1;
            }
            for (; i < len; i++)
                ret = ret * 10 + str[i] - '0';
            if (str[0] == '-') {
                ret = -ret;
            }
            return ret;
        } int len = 0; len 0 str[len++] = nextChar() str[len++] str len++ len nextChar() nextChar len = reads(len, isSpace) len reads(len, isSpace) reads len isSpace int i = 0; i 0 long ret = 0; ret 0 if (str[0] == '-') {
                i = 1;
            } str[0] == '-' str[0] str 0 '-' {
                i = 1;
            } i = 1 i 1 for (; i < len; i++)
                ret = ret * 10 + str[i] - '0'; ; i < len i len i++ i++ i ret = ret * 10 + str[i] - '0'; ret = ret * 10 + str[i] - '0' ret ret * 10 + str[i] - '0' ret * 10 + str[i] ret * 10 ret 10 str[i] str i '0' if (str[0] == '-') {
                ret = -ret;
            } str[0] == '-' str[0] str 0 '-' {
                ret = -ret;
            } ret = -ret ret -ret ret return ret; ret public char nextChar() {
            while (true) {
                final int c = read();
                if (!isSpace[c]) {
                    return (char) c;
                }
            }
        } nextChar {
            while (true) {
                final int c = read();
                if (!isSpace[c]) {
                    return (char) c;
                }
            }
        } while (true) {
                final int c = read();
                if (!isSpace[c]) {
                    return (char) c;
                }
            } true {
                final int c = read();
                if (!isSpace[c]) {
                    return (char) c;
                }
            } final int c = read(); c read() read if (!isSpace[c]) {
                    return (char) c;
                } !isSpace[c] isSpace[c] isSpace c {
                    return (char) c;
                } return (char) c; (char) c public String nextString() {
            return new String(nextChars());
        } nextString {
            return new String(nextChars());
        } return new String(nextChars()); new String(nextChars()) public char[] nextChars() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            return Arrays.copyOf(str, len);
        } nextChars {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            return Arrays.copyOf(str, len);
        } int len = 0; len 0 str[len++] = nextChar() str[len++] str len++ len nextChar() nextChar len = reads(len, isSpace) len reads(len, isSpace) reads len isSpace return Arrays.copyOf(str, len); Arrays.copyOf(str, len) Arrays.copyOf Arrays str len public char[][] next2DChars(int h, int w) {
            char[][] s = new char[h][w];
            for (int i = 0; i < h; i++) {
                s[i] = nextChars();
            }
            return s;
        } next2DChars {
            char[][] s = new char[h][w];
            for (int i = 0; i < h; i++) {
                s[i] = nextChars();
            }
            return s;
        } char[][] s = new char[h][w]; s new char[h][w] h w for (int i = 0; i < h; i++) {
                s[i] = nextChars();
            } int i = 0; int i = 0; i 0 i < h i h i++ i++ i {
                s[i] = nextChars();
            } {
                s[i] = nextChars();
            } s[i] = nextChars() s[i] s i nextChars() nextChars return s; s int h h int w w int reads(int len, boolean[] accept) {
            try {
                while (true) {
                    final int c = read();
                    if (accept[c]) {
                        break;
                    }
                    if (str.length == len) {
                        char[] rep = new char[str.length * 3 / 2];
                        System.arraycopy(str, 0, rep, 0, str.length);
                        str = rep;
                    }
                    str[len++] = (char) c;
                }
            } catch (EndOfFileRuntimeException e) {
            }
            return len;
        } reads {
            try {
                while (true) {
                    final int c = read();
                    if (accept[c]) {
                        break;
                    }
                    if (str.length == len) {
                        char[] rep = new char[str.length * 3 / 2];
                        System.arraycopy(str, 0, rep, 0, str.length);
                        str = rep;
                    }
                    str[len++] = (char) c;
                }
            } catch (EndOfFileRuntimeException e) {
            }
            return len;
        } try {
                while (true) {
                    final int c = read();
                    if (accept[c]) {
                        break;
                    }
                    if (str.length == len) {
                        char[] rep = new char[str.length * 3 / 2];
                        System.arraycopy(str, 0, rep, 0, str.length);
                        str = rep;
                    }
                    str[len++] = (char) c;
                }
            } catch (EndOfFileRuntimeException e) {
            } catch (EndOfFileRuntimeException e) {
            } EndOfFileRuntimeException e {
            } {
                while (true) {
                    final int c = read();
                    if (accept[c]) {
                        break;
                    }
                    if (str.length == len) {
                        char[] rep = new char[str.length * 3 / 2];
                        System.arraycopy(str, 0, rep, 0, str.length);
                        str = rep;
                    }
                    str[len++] = (char) c;
                }
            } while (true) {
                    final int c = read();
                    if (accept[c]) {
                        break;
                    }
                    if (str.length == len) {
                        char[] rep = new char[str.length * 3 / 2];
                        System.arraycopy(str, 0, rep, 0, str.length);
                        str = rep;
                    }
                    str[len++] = (char) c;
                } true {
                    final int c = read();
                    if (accept[c]) {
                        break;
                    }
                    if (str.length == len) {
                        char[] rep = new char[str.length * 3 / 2];
                        System.arraycopy(str, 0, rep, 0, str.length);
                        str = rep;
                    }
                    str[len++] = (char) c;
                } final int c = read(); c read() read if (accept[c]) {
                        break;
                    } accept[c] accept c {
                        break;
                    } break; if (str.length == len) {
                        char[] rep = new char[str.length * 3 / 2];
                        System.arraycopy(str, 0, rep, 0, str.length);
                        str = rep;
                    } str.length == len str.length str str.length len {
                        char[] rep = new char[str.length * 3 / 2];
                        System.arraycopy(str, 0, rep, 0, str.length);
                        str = rep;
                    } char[] rep = new char[str.length * 3 / 2]; rep new char[str.length * 3 / 2] str.length * 3 / 2 str.length * 3 str.length str str.length 3 2 System.arraycopy(str, 0, rep, 0, str.length) System.arraycopy System str 0 rep 0 str.length str str.length str = rep str rep str[len++] = (char) c str[len++] str len++ len (char) c return len; len int len len boolean[] accept accept public int[] nextIntArray(final int n) {
            final int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        } nextIntArray {
            final int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        } final int[] res = new int[n]; res new int[n] n for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                res[i] = nextInt();
            } {
                res[i] = nextInt();
            } res[i] = nextInt() res[i] res i nextInt() nextInt return res; res final int n n public int[] nextIntArray1Index(final int n) {
            final int[] res = new int[n + 1];
            for (int i = 1; i < n + 1; i++) {
                res[i] = nextInt();
            }
            return res;
        } nextIntArray1Index {
            final int[] res = new int[n + 1];
            for (int i = 1; i < n + 1; i++) {
                res[i] = nextInt();
            }
            return res;
        } final int[] res = new int[n + 1]; res new int[n + 1] n + 1 n 1 for (int i = 1; i < n + 1; i++) {
                res[i] = nextInt();
            } int i = 1; int i = 1; i 1 i < n + 1 i n + 1 n 1 i++ i++ i {
                res[i] = nextInt();
            } {
                res[i] = nextInt();
            } res[i] = nextInt() res[i] res i nextInt() nextInt return res; res final int n n public int[] nextIntArrayDec(final int n) {
            final int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt() - 1;
            }
            return res;
        } nextIntArrayDec {
            final int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt() - 1;
            }
            return res;
        } final int[] res = new int[n]; res new int[n] n for (int i = 0; i < n; i++) {
                res[i] = nextInt() - 1;
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                res[i] = nextInt() - 1;
            } {
                res[i] = nextInt() - 1;
            } res[i] = nextInt() - 1 res[i] res i nextInt() - 1 nextInt() nextInt 1 return res; res final int n n public long[] nextLongArray(final int n) {
            final long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong();
            }
            return res;
        } nextLongArray {
            final long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong();
            }
            return res;
        } final long[] res = new long[n]; res new long[n] n for (int i = 0; i < n; i++) {
                res[i] = nextLong();
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                res[i] = nextLong();
            } {
                res[i] = nextLong();
            } res[i] = nextLong() res[i] res i nextLong() nextLong return res; res final int n n public long[] nextLongArray1Index(final int n) {
            final long[] res = new long[n + 1];
            for (int i = 1; i < n + 1; i++) {
                res[i] = nextLong();
            }
            return res;
        } nextLongArray1Index {
            final long[] res = new long[n + 1];
            for (int i = 1; i < n + 1; i++) {
                res[i] = nextLong();
            }
            return res;
        } final long[] res = new long[n + 1]; res new long[n + 1] n + 1 n 1 for (int i = 1; i < n + 1; i++) {
                res[i] = nextLong();
            } int i = 1; int i = 1; i 1 i < n + 1 i n + 1 n 1 i++ i++ i {
                res[i] = nextLong();
            } {
                res[i] = nextLong();
            } res[i] = nextLong() res[i] res i nextLong() nextLong return res; res final int n n public long[] nextLongArrayDec(final int n) {
            final long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong() - 1;
            }
            return res;
        } nextLongArrayDec {
            final long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong() - 1;
            }
            return res;
        } final long[] res = new long[n]; res new long[n] n for (int i = 0; i < n; i++) {
                res[i] = nextLong() - 1;
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                res[i] = nextLong() - 1;
            } {
                res[i] = nextLong() - 1;
            } res[i] = nextLong() - 1 res[i] res i nextLong() - 1 nextLong() nextLong 1 return res; res final int n n public double nextDouble() {
            return Double.parseDouble(nextString());
        } nextDouble {
            return Double.parseDouble(nextString());
        } return Double.parseDouble(nextString()); Double.parseDouble(nextString()) Double.parseDouble Double nextString() nextString public double[] nextDoubleArray(int n) {
            double[] res = new double[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextDouble();
            }
            return res;
        } nextDoubleArray {
            double[] res = new double[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextDouble();
            }
            return res;
        } double[] res = new double[n]; res new double[n] n for (int i = 0; i < n; i++) {
                res[i] = nextDouble();
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                res[i] = nextDouble();
            } {
                res[i] = nextDouble();
            } res[i] = nextDouble() res[i] res i nextDouble() nextDouble return res; res int n n static class EndOfFileRuntimeException extends RuntimeException {
        } EndOfFileRuntimeException RuntimeException public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyInput in = new MyInput(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskX solver = new TaskX();
        solver.solve(1, in, out);
        out.close();
    }

    static int INF = 1 << 30;
    static long LINF = 1L << 55;
    static int MOD = 1000000007;
    static int[] mh4 = {0, -1, 1, 0};
    static int[] mw4 = {-1, 0, 0, 1};
    static int[] mh8 = {-1, -1, -1, 0, 0, 1, 1, 1};
    static int[] mw8 = {-1, 0, 1, -1, 1, -1, 0, 1};

    static class TaskX {

        public void solve(int testNumber, MyInput in, PrintWriter out) {
            char[] s = in.nextChars(), t = in.nextChars();
            int ans = INF;
            for (int i = 0; i <= s.length - t.length; i++) {
                int diff = 0;
                for (int j = 0; j < t.length; j++) {
                    if (s[i + j] != t[j]) diff++;
                }
                if (diff < ans) ans = diff;
            }
            out.println(ans);
        }
    }

    static class MyInput {
        private final BufferedReader in;
        private static int pos;
        private static int readLen;
        private static final char[] buffer = new char[1024 * 8];
        private static char[] str = new char[500 * 8 * 2];
        private static boolean[] isDigit = new boolean[256];
        private static boolean[] isSpace = new boolean[256];
        private static boolean[] isLineSep = new boolean[256];

        static {
            for (int i = 0; i < 10; i++) {
                isDigit['0' + i] = true;
            }
            isDigit['-'] = true;
            isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true;
            isLineSep['\r'] = isLineSep['\n'] = true;
        }

        public MyInput(InputStream is) {
            in = new BufferedReader(new InputStreamReader(is));
        }

        public int read() {
            if (pos >= readLen) {
                pos = 0;
                try {
                    readLen = in.read(buffer);
                } catch (IOException e) {
                    throw new RuntimeException();
                }
                if (readLen <= 0) {
                    throw new EndOfFileRuntimeException();
                }
            }
            return buffer[pos++];
        }

        public int nextInt() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            int i = 0;
            int ret = 0;
            if (str[0] == '-') {
                i = 1;
            }
            for (; i < len; i++)
                ret = ret * 10 + str[i] - '0';
            if (str[0] == '-') {
                ret = -ret;
            }
            return ret;
        }

        public long nextLong() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            int i = 0;
            long ret = 0;
            if (str[0] == '-') {
                i = 1;
            }
            for (; i < len; i++)
                ret = ret * 10 + str[i] - '0';
            if (str[0] == '-') {
                ret = -ret;
            }
            return ret;
        }

        public char nextChar() {
            while (true) {
                final int c = read();
                if (!isSpace[c]) {
                    return (char) c;
                }
            }
        }

        public String nextString() {
            return new String(nextChars());
        }

        public char[] nextChars() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            return Arrays.copyOf(str, len);
        }

        public char[][] next2DChars(int h, int w) {
            char[][] s = new char[h][w];
            for (int i = 0; i < h; i++) {
                s[i] = nextChars();
            }
            return s;
        }

        int reads(int len, boolean[] accept) {
            try {
                while (true) {
                    final int c = read();
                    if (accept[c]) {
                        break;
                    }
                    if (str.length == len) {
                        char[] rep = new char[str.length * 3 / 2];
                        System.arraycopy(str, 0, rep, 0, str.length);
                        str = rep;
                    }
                    str[len++] = (char) c;
                }
            } catch (EndOfFileRuntimeException e) {
            }
            return len;
        }

        public int[] nextIntArray(final int n) {
            final int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public int[] nextIntArray1Index(final int n) {
            final int[] res = new int[n + 1];
            for (int i = 1; i < n + 1; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public int[] nextIntArrayDec(final int n) {
            final int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt() - 1;
            }
            return res;
        }

        public long[] nextLongArray(final int n) {
            final long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long[] nextLongArray1Index(final int n) {
            final long[] res = new long[n + 1];
            for (int i = 1; i < n + 1; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long[] nextLongArrayDec(final int n) {
            final long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong() - 1;
            }
            return res;
        }

        public double nextDouble() {
            return Double.parseDouble(nextString());
        }

        public double[] nextDoubleArray(int n) {
            double[] res = new double[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextDouble();
            }
            return res;
        }

        static class EndOfFileRuntimeException extends RuntimeException {
        }

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

    static int INF = 1 << 30;
    static long LINF = 1L << 55;
    static int MOD = 1000000007;
    static int[] mh4 = {0, -1, 1, 0};
    static int[] mw4 = {-1, 0, 0, 1};
    static int[] mh8 = {-1, -1, -1, 0, 0, 1, 1, 1};
    static int[] mw8 = {-1, 0, 1, -1, 1, -1, 0, 1};

    static class TaskX {

        public void solve(int testNumber, MyInput in, PrintWriter out) {
            char[] s = in.nextChars(), t = in.nextChars();
            int ans = INF;
            for (int i = 0; i <= s.length - t.length; i++) {
                int diff = 0;
                for (int j = 0; j < t.length; j++) {
                    if (s[i + j] != t[j]) diff++;
                }
                if (diff < ans) ans = diff;
            }
            out.println(ans);
        }
    }

    static class MyInput {
        private final BufferedReader in;
        private static int pos;
        private static int readLen;
        private static final char[] buffer = new char[1024 * 8];
        private static char[] str = new char[500 * 8 * 2];
        private static boolean[] isDigit = new boolean[256];
        private static boolean[] isSpace = new boolean[256];
        private static boolean[] isLineSep = new boolean[256];

        static {
            for (int i = 0; i < 10; i++) {
                isDigit['0' + i] = true;
            }
            isDigit['-'] = true;
            isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true;
            isLineSep['\r'] = isLineSep['\n'] = true;
        }

        public MyInput(InputStream is) {
            in = new BufferedReader(new InputStreamReader(is));
        }

        public int read() {
            if (pos >= readLen) {
                pos = 0;
                try {
                    readLen = in.read(buffer);
                } catch (IOException e) {
                    throw new RuntimeException();
                }
                if (readLen <= 0) {
                    throw new EndOfFileRuntimeException();
                }
            }
            return buffer[pos++];
        }

        public int nextInt() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            int i = 0;
            int ret = 0;
            if (str[0] == '-') {
                i = 1;
            }
            for (; i < len; i++)
                ret = ret * 10 + str[i] - '0';
            if (str[0] == '-') {
                ret = -ret;
            }
            return ret;
        }

        public long nextLong() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            int i = 0;
            long ret = 0;
            if (str[0] == '-') {
                i = 1;
            }
            for (; i < len; i++)
                ret = ret * 10 + str[i] - '0';
            if (str[0] == '-') {
                ret = -ret;
            }
            return ret;
        }

        public char nextChar() {
            while (true) {
                final int c = read();
                if (!isSpace[c]) {
                    return (char) c;
                }
            }
        }

        public String nextString() {
            return new String(nextChars());
        }

        public char[] nextChars() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            return Arrays.copyOf(str, len);
        }

        public char[][] next2DChars(int h, int w) {
            char[][] s = new char[h][w];
            for (int i = 0; i < h; i++) {
                s[i] = nextChars();
            }
            return s;
        }

        int reads(int len, boolean[] accept) {
            try {
                while (true) {
                    final int c = read();
                    if (accept[c]) {
                        break;
                    }
                    if (str.length == len) {
                        char[] rep = new char[str.length * 3 / 2];
                        System.arraycopy(str, 0, rep, 0, str.length);
                        str = rep;
                    }
                    str[len++] = (char) c;
                }
            } catch (EndOfFileRuntimeException e) {
            }
            return len;
        }

        public int[] nextIntArray(final int n) {
            final int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public int[] nextIntArray1Index(final int n) {
            final int[] res = new int[n + 1];
            for (int i = 1; i < n + 1; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public int[] nextIntArrayDec(final int n) {
            final int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt() - 1;
            }
            return res;
        }

        public long[] nextLongArray(final int n) {
            final long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long[] nextLongArray1Index(final int n) {
            final long[] res = new long[n + 1];
            for (int i = 1; i < n + 1; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long[] nextLongArrayDec(final int n) {
            final long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong() - 1;
            }
            return res;
        }

        public double nextDouble() {
            return Double.parseDouble(nextString());
        }

        public double[] nextDoubleArray(int n) {
            double[] res = new double[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextDouble();
            }
            return res;
        }

        static class EndOfFileRuntimeException extends RuntimeException {
        }

    }
} Main
import java.io.*;
import java.util.Arrays;

/**
 * @author tutuz on 2020/08/30
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyInput in = new MyInput(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskX solver = new TaskX();
        solver.solve(1, in, out);
        out.close();
    }

    static int INF = 1 << 30;
    static long LINF = 1L << 55;
    static int MOD = 1000000007;
    static int[] mh4 = {0, -1, 1, 0};
    static int[] mw4 = {-1, 0, 0, 1};
    static int[] mh8 = {-1, -1, -1, 0, 0, 1, 1, 1};
    static int[] mw8 = {-1, 0, 1, -1, 1, -1, 0, 1};

    static class TaskX {

        public void solve(int testNumber, MyInput in, PrintWriter out) {
            char[] s = in.nextChars(), t = in.nextChars();
            int ans = INF;
            for (int i = 0; i <= s.length - t.length; i++) {
                int diff = 0;
                for (int j = 0; j < t.length; j++) {
                    if (s[i + j] != t[j]) diff++;
                }
                if (diff < ans) ans = diff;
            }
            out.println(ans);
        }
    }

    static class MyInput {
        private final BufferedReader in;
        private static int pos;
        private static int readLen;
        private static final char[] buffer = new char[1024 * 8];
        private static char[] str = new char[500 * 8 * 2];
        private static boolean[] isDigit = new boolean[256];
        private static boolean[] isSpace = new boolean[256];
        private static boolean[] isLineSep = new boolean[256];

        static {
            for (int i = 0; i < 10; i++) {
                isDigit['0' + i] = true;
            }
            isDigit['-'] = true;
            isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true;
            isLineSep['\r'] = isLineSep['\n'] = true;
        }

        public MyInput(InputStream is) {
            in = new BufferedReader(new InputStreamReader(is));
        }

        public int read() {
            if (pos >= readLen) {
                pos = 0;
                try {
                    readLen = in.read(buffer);
                } catch (IOException e) {
                    throw new RuntimeException();
                }
                if (readLen <= 0) {
                    throw new EndOfFileRuntimeException();
                }
            }
            return buffer[pos++];
        }

        public int nextInt() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            int i = 0;
            int ret = 0;
            if (str[0] == '-') {
                i = 1;
            }
            for (; i < len; i++)
                ret = ret * 10 + str[i] - '0';
            if (str[0] == '-') {
                ret = -ret;
            }
            return ret;
        }

        public long nextLong() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            int i = 0;
            long ret = 0;
            if (str[0] == '-') {
                i = 1;
            }
            for (; i < len; i++)
                ret = ret * 10 + str[i] - '0';
            if (str[0] == '-') {
                ret = -ret;
            }
            return ret;
        }

        public char nextChar() {
            while (true) {
                final int c = read();
                if (!isSpace[c]) {
                    return (char) c;
                }
            }
        }

        public String nextString() {
            return new String(nextChars());
        }

        public char[] nextChars() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            return Arrays.copyOf(str, len);
        }

        public char[][] next2DChars(int h, int w) {
            char[][] s = new char[h][w];
            for (int i = 0; i < h; i++) {
                s[i] = nextChars();
            }
            return s;
        }

        int reads(int len, boolean[] accept) {
            try {
                while (true) {
                    final int c = read();
                    if (accept[c]) {
                        break;
                    }
                    if (str.length == len) {
                        char[] rep = new char[str.length * 3 / 2];
                        System.arraycopy(str, 0, rep, 0, str.length);
                        str = rep;
                    }
                    str[len++] = (char) c;
                }
            } catch (EndOfFileRuntimeException e) {
            }
            return len;
        }

        public int[] nextIntArray(final int n) {
            final int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public int[] nextIntArray1Index(final int n) {
            final int[] res = new int[n + 1];
            for (int i = 1; i < n + 1; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public int[] nextIntArrayDec(final int n) {
            final int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt() - 1;
            }
            return res;
        }

        public long[] nextLongArray(final int n) {
            final long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long[] nextLongArray1Index(final int n) {
            final long[] res = new long[n + 1];
            for (int i = 1; i < n + 1; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long[] nextLongArrayDec(final int n) {
            final long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong() - 1;
            }
            return res;
        }

        public double nextDouble() {
            return Double.parseDouble(nextString());
        }

        public double[] nextDoubleArray(int n) {
            double[] res = new double[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextDouble();
            }
            return res;
        }

        static class EndOfFileRuntimeException extends RuntimeException {
        }

    }
}
