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

    public class Main {

        public static void main(String[] args) throws IOException {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);
            BufferedReader reader = new BufferedReader(new InputReader(System.in));

            String s = in.next();
            String t = in.next();
            if(s.contains(t)) out.println(0);
            else {
                int ans = t.length();
                int n = t.length();
                for (int i = 0; i <=s.length() - n; i++) {
                    String sub = s.substring(i,i+n);
                    int diff = 0;
                    for (int j = 0; j < sub.length(); j++) {
                        if(sub.charAt(j) != t.charAt(j)) diff++;
                    }
                    ans = Math.min(ans,diff);
                }
                out.println(ans);
            }
            out.flush();
        }
        private static int gcd(int a, int b) {
            return b == 0 ? a : gcd(b,a%b);
        }
        private static void shuffle(int [] a) {
            for (int i = 0; i < a.length; i++) {
                int index = (int) (Math.random() * a.length);
                int temp = a[index];
                a[index] = a[i];
                a[i] = temp;
            }
        }
    }

    class InputReader extends BufferedReader {
        StringTokenizer tokenizer;

        public InputReader(InputStream inputStream) {
            super(new InputStreamReader(inputStream), 32768);
        }

        public InputReader(String filename) {
            super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(readLine());
                } catch (IOException e) {
                    throw new RuntimeException();
                }
            }
            return tokenizer.nextToken();
        }

        public Integer nextInt() {
            return Integer.valueOf(next());
        }
        public Long nextLong() {
            return  Long.valueOf(next());
        }
        public Double nextDouble () {
            return Double.valueOf(next());
        }


        static class OutputWriter extends PrintWriter {
            public OutputWriter(OutputStream outputStream) {
                super(outputStream);
            }

            public OutputWriter(Writer writer) {
                super(writer);
            }

            public OutputWriter(String filename) throws FileNotFoundException {
                super(filename);
            }

            public void close() {
                super.close();
            }
        }
    } import java.io.*; io.* java import java.util.*; util.* java import java.util.LinkedList; LinkedList java.util public class Main {

        public static void main(String[] args) throws IOException {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);
            BufferedReader reader = new BufferedReader(new InputReader(System.in));

            String s = in.next();
            String t = in.next();
            if(s.contains(t)) out.println(0);
            else {
                int ans = t.length();
                int n = t.length();
                for (int i = 0; i <=s.length() - n; i++) {
                    String sub = s.substring(i,i+n);
                    int diff = 0;
                    for (int j = 0; j < sub.length(); j++) {
                        if(sub.charAt(j) != t.charAt(j)) diff++;
                    }
                    ans = Math.min(ans,diff);
                }
                out.println(ans);
            }
            out.flush();
        }
        private static int gcd(int a, int b) {
            return b == 0 ? a : gcd(b,a%b);
        }
        private static void shuffle(int [] a) {
            for (int i = 0; i < a.length; i++) {
                int index = (int) (Math.random() * a.length);
                int temp = a[index];
                a[index] = a[i];
                a[i] = temp;
            }
        }
    } Main public static void main(String[] args) throws IOException {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);
            BufferedReader reader = new BufferedReader(new InputReader(System.in));

            String s = in.next();
            String t = in.next();
            if(s.contains(t)) out.println(0);
            else {
                int ans = t.length();
                int n = t.length();
                for (int i = 0; i <=s.length() - n; i++) {
                    String sub = s.substring(i,i+n);
                    int diff = 0;
                    for (int j = 0; j < sub.length(); j++) {
                        if(sub.charAt(j) != t.charAt(j)) diff++;
                    }
                    ans = Math.min(ans,diff);
                }
                out.println(ans);
            }
            out.flush();
        } main {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);
            BufferedReader reader = new BufferedReader(new InputReader(System.in));

            String s = in.next();
            String t = in.next();
            if(s.contains(t)) out.println(0);
            else {
                int ans = t.length();
                int n = t.length();
                for (int i = 0; i <=s.length() - n; i++) {
                    String sub = s.substring(i,i+n);
                    int diff = 0;
                    for (int j = 0; j < sub.length(); j++) {
                        if(sub.charAt(j) != t.charAt(j)) diff++;
                    }
                    ans = Math.min(ans,diff);
                }
                out.println(ans);
            }
            out.flush();
        } 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) InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream); out new InputReader.OutputWriter(outputStream) BufferedReader reader = new BufferedReader(new InputReader(System.in)); reader new BufferedReader(new InputReader(System.in)) String s = in.next(); s in.next() in.next in String t = in.next(); t in.next() in.next in if(s.contains(t)) out.println(0);
            else {
                int ans = t.length();
                int n = t.length();
                for (int i = 0; i <=s.length() - n; i++) {
                    String sub = s.substring(i,i+n);
                    int diff = 0;
                    for (int j = 0; j < sub.length(); j++) {
                        if(sub.charAt(j) != t.charAt(j)) diff++;
                    }
                    ans = Math.min(ans,diff);
                }
                out.println(ans);
            } s.contains(t) s.contains s t out.println(0) out.println out 0 {
                int ans = t.length();
                int n = t.length();
                for (int i = 0; i <=s.length() - n; i++) {
                    String sub = s.substring(i,i+n);
                    int diff = 0;
                    for (int j = 0; j < sub.length(); j++) {
                        if(sub.charAt(j) != t.charAt(j)) diff++;
                    }
                    ans = Math.min(ans,diff);
                }
                out.println(ans);
            } int ans = t.length(); ans t.length() t.length t int n = t.length(); n t.length() t.length t for (int i = 0; i <=s.length() - n; i++) {
                    String sub = s.substring(i,i+n);
                    int diff = 0;
                    for (int j = 0; j < sub.length(); j++) {
                        if(sub.charAt(j) != t.charAt(j)) diff++;
                    }
                    ans = Math.min(ans,diff);
                } int i = 0; int i = 0; i 0 i <=s.length() - n i s.length() - n s.length() s.length s n i++ i++ i {
                    String sub = s.substring(i,i+n);
                    int diff = 0;
                    for (int j = 0; j < sub.length(); j++) {
                        if(sub.charAt(j) != t.charAt(j)) diff++;
                    }
                    ans = Math.min(ans,diff);
                } {
                    String sub = s.substring(i,i+n);
                    int diff = 0;
                    for (int j = 0; j < sub.length(); j++) {
                        if(sub.charAt(j) != t.charAt(j)) diff++;
                    }
                    ans = Math.min(ans,diff);
                } String sub = s.substring(i,i+n); sub s.substring(i,i+n) s.substring s i i+n i n int diff = 0; diff 0 for (int j = 0; j < sub.length(); j++) {
                        if(sub.charAt(j) != t.charAt(j)) diff++;
                    } int j = 0; int j = 0; j 0 j < sub.length() j sub.length() sub.length sub j++ j++ j {
                        if(sub.charAt(j) != t.charAt(j)) diff++;
                    } {
                        if(sub.charAt(j) != t.charAt(j)) diff++;
                    } if(sub.charAt(j) != t.charAt(j)) diff++; sub.charAt(j) != t.charAt(j) sub.charAt(j) sub.charAt sub j t.charAt(j) t.charAt t j diff++ diff ans = Math.min(ans,diff) ans Math.min(ans,diff) Math.min Math ans diff out.println(ans) out.println out ans out.flush() out.flush out String[] args args private static int gcd(int a, int b) {
            return b == 0 ? a : gcd(b,a%b);
        } gcd {
            return b == 0 ? a : gcd(b,a%b);
        } return b == 0 ? a : gcd(b,a%b); b == 0 ? a : gcd(b,a%b) b == 0 b 0 a gcd(b,a%b) gcd b a%b a b int a a int b b private static void shuffle(int [] a) {
            for (int i = 0; i < a.length; i++) {
                int index = (int) (Math.random() * a.length);
                int temp = a[index];
                a[index] = a[i];
                a[i] = temp;
            }
        } shuffle {
            for (int i = 0; i < a.length; i++) {
                int index = (int) (Math.random() * a.length);
                int temp = a[index];
                a[index] = a[i];
                a[i] = temp;
            }
        } for (int i = 0; i < a.length; i++) {
                int index = (int) (Math.random() * a.length);
                int temp = a[index];
                a[index] = a[i];
                a[i] = temp;
            } int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
                int index = (int) (Math.random() * a.length);
                int temp = a[index];
                a[index] = a[i];
                a[i] = temp;
            } {
                int index = (int) (Math.random() * a.length);
                int temp = a[index];
                a[index] = a[i];
                a[i] = temp;
            } int index = (int) (Math.random() * a.length); index (int) (Math.random() * a.length) Math.random() Math.random Math a.length a a.length int temp = a[index]; temp a[index] a index a[index] = a[i] a[index] a index a[i] a i a[i] = temp a[i] a i temp int [] a a class InputReader extends BufferedReader {
        StringTokenizer tokenizer;

        public InputReader(InputStream inputStream) {
            super(new InputStreamReader(inputStream), 32768);
        }

        public InputReader(String filename) {
            super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(readLine());
                } catch (IOException e) {
                    throw new RuntimeException();
                }
            }
            return tokenizer.nextToken();
        }

        public Integer nextInt() {
            return Integer.valueOf(next());
        }
        public Long nextLong() {
            return  Long.valueOf(next());
        }
        public Double nextDouble () {
            return Double.valueOf(next());
        }


        static class OutputWriter extends PrintWriter {
            public OutputWriter(OutputStream outputStream) {
                super(outputStream);
            }

            public OutputWriter(Writer writer) {
                super(writer);
            }

            public OutputWriter(String filename) throws FileNotFoundException {
                super(filename);
            }

            public void close() {
                super.close();
            }
        }
    } InputReader StringTokenizer tokenizer; tokenizer public InputReader(InputStream inputStream) {
            super(new InputStreamReader(inputStream), 32768);
        } InputReader {
            super(new InputStreamReader(inputStream), 32768);
        } super(new InputStreamReader(inputStream), 32768) super new InputStreamReader(inputStream) 32768 InputStream inputStream inputStream public InputReader(String filename) {
            super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));
        } InputReader {
            super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));
        } super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename))) super new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)) String filename filename public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(readLine());
                } catch (IOException e) {
                    throw new RuntimeException();
                }
            }
            return tokenizer.nextToken();
        } next {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(readLine());
                } catch (IOException e) {
                    throw new RuntimeException();
                }
            }
            return tokenizer.nextToken();
        } while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(readLine());
                } catch (IOException e) {
                    throw new RuntimeException();
                }
            } tokenizer == null || !tokenizer.hasMoreTokens() tokenizer == null tokenizer null !tokenizer.hasMoreTokens() tokenizer.hasMoreTokens() tokenizer.hasMoreTokens tokenizer {
                try {
                    tokenizer = new StringTokenizer(readLine());
                } catch (IOException e) {
                    throw new RuntimeException();
                }
            } try {
                    tokenizer = new StringTokenizer(readLine());
                } catch (IOException e) {
                    throw new RuntimeException();
                } catch (IOException e) {
                    throw new RuntimeException();
                } IOException e {
                    throw new RuntimeException();
                } throw new RuntimeException(); new RuntimeException() {
                    tokenizer = new StringTokenizer(readLine());
                } tokenizer = new StringTokenizer(readLine()) tokenizer new StringTokenizer(readLine()) return tokenizer.nextToken(); tokenizer.nextToken() tokenizer.nextToken tokenizer public Integer nextInt() {
            return Integer.valueOf(next());
        } nextInt {
            return Integer.valueOf(next());
        } return Integer.valueOf(next()); Integer.valueOf(next()) Integer.valueOf Integer next() next public Long nextLong() {
            return  Long.valueOf(next());
        } nextLong {
            return  Long.valueOf(next());
        } return  Long.valueOf(next()); Long.valueOf(next()) Long.valueOf Long next() next public Double nextDouble () {
            return Double.valueOf(next());
        } nextDouble {
            return Double.valueOf(next());
        } return Double.valueOf(next()); Double.valueOf(next()) Double.valueOf Double next() next static class OutputWriter extends PrintWriter {
            public OutputWriter(OutputStream outputStream) {
                super(outputStream);
            }

            public OutputWriter(Writer writer) {
                super(writer);
            }

            public OutputWriter(String filename) throws FileNotFoundException {
                super(filename);
            }

            public void close() {
                super.close();
            }
        } OutputWriter public OutputWriter(OutputStream outputStream) {
                super(outputStream);
            } OutputWriter {
                super(outputStream);
            } super(outputStream) super outputStream OutputStream outputStream outputStream public OutputWriter(Writer writer) {
                super(writer);
            } OutputWriter {
                super(writer);
            } super(writer) super writer Writer writer writer public OutputWriter(String filename) throws FileNotFoundException {
                super(filename);
            } OutputWriter {
                super(filename);
            } super(filename) super filename String filename filename public void close() {
                super.close();
            } close {
                super.close();
            } super.close() super.close super PrintWriter BufferedReader public class Main {

        public static void main(String[] args) throws IOException {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);
            BufferedReader reader = new BufferedReader(new InputReader(System.in));

            String s = in.next();
            String t = in.next();
            if(s.contains(t)) out.println(0);
            else {
                int ans = t.length();
                int n = t.length();
                for (int i = 0; i <=s.length() - n; i++) {
                    String sub = s.substring(i,i+n);
                    int diff = 0;
                    for (int j = 0; j < sub.length(); j++) {
                        if(sub.charAt(j) != t.charAt(j)) diff++;
                    }
                    ans = Math.min(ans,diff);
                }
                out.println(ans);
            }
            out.flush();
        }
        private static int gcd(int a, int b) {
            return b == 0 ? a : gcd(b,a%b);
        }
        private static void shuffle(int [] a) {
            for (int i = 0; i < a.length; i++) {
                int index = (int) (Math.random() * a.length);
                int temp = a[index];
                a[index] = a[i];
                a[i] = temp;
            }
        }
    } public class Main {

        public static void main(String[] args) throws IOException {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);
            BufferedReader reader = new BufferedReader(new InputReader(System.in));

            String s = in.next();
            String t = in.next();
            if(s.contains(t)) out.println(0);
            else {
                int ans = t.length();
                int n = t.length();
                for (int i = 0; i <=s.length() - n; i++) {
                    String sub = s.substring(i,i+n);
                    int diff = 0;
                    for (int j = 0; j < sub.length(); j++) {
                        if(sub.charAt(j) != t.charAt(j)) diff++;
                    }
                    ans = Math.min(ans,diff);
                }
                out.println(ans);
            }
            out.flush();
        }
        private static int gcd(int a, int b) {
            return b == 0 ? a : gcd(b,a%b);
        }
        private static void shuffle(int [] a) {
            for (int i = 0; i < a.length; i++) {
                int index = (int) (Math.random() * a.length);
                int temp = a[index];
                a[index] = a[i];
                a[i] = temp;
            }
        }
    } Main
    import java.io.*;
    import java.util.*;
    import java.util.LinkedList;

    public class Main {

        public static void main(String[] args) throws IOException {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);
            BufferedReader reader = new BufferedReader(new InputReader(System.in));

            String s = in.next();
            String t = in.next();
            if(s.contains(t)) out.println(0);
            else {
                int ans = t.length();
                int n = t.length();
                for (int i = 0; i <=s.length() - n; i++) {
                    String sub = s.substring(i,i+n);
                    int diff = 0;
                    for (int j = 0; j < sub.length(); j++) {
                        if(sub.charAt(j) != t.charAt(j)) diff++;
                    }
                    ans = Math.min(ans,diff);
                }
                out.println(ans);
            }
            out.flush();
        }
        private static int gcd(int a, int b) {
            return b == 0 ? a : gcd(b,a%b);
        }
        private static void shuffle(int [] a) {
            for (int i = 0; i < a.length; i++) {
                int index = (int) (Math.random() * a.length);
                int temp = a[index];
                a[index] = a[i];
                a[i] = temp;
            }
        }
    }

    class InputReader extends BufferedReader {
        StringTokenizer tokenizer;

        public InputReader(InputStream inputStream) {
            super(new InputStreamReader(inputStream), 32768);
        }

        public InputReader(String filename) {
            super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(readLine());
                } catch (IOException e) {
                    throw new RuntimeException();
                }
            }
            return tokenizer.nextToken();
        }

        public Integer nextInt() {
            return Integer.valueOf(next());
        }
        public Long nextLong() {
            return  Long.valueOf(next());
        }
        public Double nextDouble () {
            return Double.valueOf(next());
        }


        static class OutputWriter extends PrintWriter {
            public OutputWriter(OutputStream outputStream) {
                super(outputStream);
            }

            public OutputWriter(Writer writer) {
                super(writer);
            }

            public OutputWriter(String filename) throws FileNotFoundException {
                super(filename);
            }

            public void close() {
                super.close();
            }
        }
    }