// dont fuck with my love
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.stream.*;

public class Main
{
    static class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next(){
            while(st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt(){
            return Integer.parseInt(next());
        }
        long nextLong(){
            return Long.parseLong(next());
        }
        double nextDouble(){
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            } catch (Exception e){
                e.printStackTrace();
            }
            return str;
        }
    }
    static int modPower(int x, int y, int mod){
        int res = 1;
        x %= mod;
        if(x==0) return 0;
        while(y>0){
            if(y%2==1){
                res = (res*x)%mod;
            }
            y = y>>1;
            x = (x*x)%mod;
        }
        return res;
    }
    public static int[] readArray(int n){
        FastReader in = new FastReader();
        int[] a = new int[n];
        for(int i = 0; i < n; i++) a[i] = in.nextInt();
        return a;
    }
    static class pair{
        int first, second;
        pair(int first, int second){
            this.first = first;
            this.second = second;
        }
    }
    public static void main (String[] args) throws java.lang.Exception
    {
        // your code goes here
        FastReader in = new FastReader();
        String s = in.nextLine(), t = in.nextLine();
        int ans = Integer.MAX_VALUE;
        for(int i = 0; i <= s.length() - t.length(); i++) {
            int c = 0;
            for(int j = 0; j < t.length(); j++) {
                if(s.charAt(j+i) != t.charAt(j)) c++;
            }
            ans = Math.min(c, ans);
        }
        System.out.println(ans);
    }
} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java import java.util.stream.*; stream.* java.util public class Main
{
    static class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next(){
            while(st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt(){
            return Integer.parseInt(next());
        }
        long nextLong(){
            return Long.parseLong(next());
        }
        double nextDouble(){
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            } catch (Exception e){
                e.printStackTrace();
            }
            return str;
        }
    }
    static int modPower(int x, int y, int mod){
        int res = 1;
        x %= mod;
        if(x==0) return 0;
        while(y>0){
            if(y%2==1){
                res = (res*x)%mod;
            }
            y = y>>1;
            x = (x*x)%mod;
        }
        return res;
    }
    public static int[] readArray(int n){
        FastReader in = new FastReader();
        int[] a = new int[n];
        for(int i = 0; i < n; i++) a[i] = in.nextInt();
        return a;
    }
    static class pair{
        int first, second;
        pair(int first, int second){
            this.first = first;
            this.second = second;
        }
    }
    public static void main (String[] args) throws java.lang.Exception
    {
        // your code goes here
        FastReader in = new FastReader();
        String s = in.nextLine(), t = in.nextLine();
        int ans = Integer.MAX_VALUE;
        for(int i = 0; i <= s.length() - t.length(); i++) {
            int c = 0;
            for(int j = 0; j < t.length(); j++) {
                if(s.charAt(j+i) != t.charAt(j)) c++;
            }
            ans = Math.min(c, ans);
        }
        System.out.println(ans);
    }
} Main static int modPower(int x, int y, int mod){
        int res = 1;
        x %= mod;
        if(x==0) return 0;
        while(y>0){
            if(y%2==1){
                res = (res*x)%mod;
            }
            y = y>>1;
            x = (x*x)%mod;
        }
        return res;
    } modPower {
        int res = 1;
        x %= mod;
        if(x==0) return 0;
        while(y>0){
            if(y%2==1){
                res = (res*x)%mod;
            }
            y = y>>1;
            x = (x*x)%mod;
        }
        return res;
    } int res = 1; res 1 x %= mod x mod if(x==0) return 0; x==0 x 0 return 0; 0 while(y>0){
            if(y%2==1){
                res = (res*x)%mod;
            }
            y = y>>1;
            x = (x*x)%mod;
        } y>0 y 0 {
            if(y%2==1){
                res = (res*x)%mod;
            }
            y = y>>1;
            x = (x*x)%mod;
        } if(y%2==1){
                res = (res*x)%mod;
            } y%2==1 y%2 y 2 1 {
                res = (res*x)%mod;
            } res = (res*x)%mod res (res*x)%mod (res*x) res x mod y = y>>1 y y>>1 y 1 x = (x*x)%mod x (x*x)%mod (x*x) x x mod return res; res int x x int y y int mod mod public static int[] readArray(int n){
        FastReader in = new FastReader();
        int[] a = new int[n];
        for(int i = 0; i < n; i++) a[i] = in.nextInt();
        return a;
    } readArray {
        FastReader in = new FastReader();
        int[] a = new int[n];
        for(int i = 0; i < n; i++) a[i] = in.nextInt();
        return a;
    } FastReader in = new FastReader(); in new FastReader() int[] a = new int[n]; a new int[n] n for(int i = 0; i < n; i++) a[i] = in.nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = in.nextInt(); a[i] = in.nextInt() a[i] a i in.nextInt() in.nextInt in return a; a int n n public static void main (String[] args) throws java.lang.Exception
    {
        // your code goes here
        FastReader in = new FastReader();
        String s = in.nextLine(), t = in.nextLine();
        int ans = Integer.MAX_VALUE;
        for(int i = 0; i <= s.length() - t.length(); i++) {
            int c = 0;
            for(int j = 0; j < t.length(); j++) {
                if(s.charAt(j+i) != t.charAt(j)) c++;
            }
            ans = Math.min(c, ans);
        }
        System.out.println(ans);
    } main {
        // your code goes here
        FastReader in = new FastReader();
        String s = in.nextLine(), t = in.nextLine();
        int ans = Integer.MAX_VALUE;
        for(int i = 0; i <= s.length() - t.length(); i++) {
            int c = 0;
            for(int j = 0; j < t.length(); j++) {
                if(s.charAt(j+i) != t.charAt(j)) c++;
            }
            ans = Math.min(c, ans);
        }
        System.out.println(ans);
    } FastReader in = new FastReader(); in new FastReader() String s = in.nextLine() s in.nextLine() in.nextLine in t = in.nextLine(); t in.nextLine() in.nextLine in int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i = 0; i <= s.length() - t.length(); i++) {
            int c = 0;
            for(int j = 0; j < t.length(); j++) {
                if(s.charAt(j+i) != t.charAt(j)) c++;
            }
            ans = Math.min(c, ans);
        } int i = 0; int i = 0; i 0 i <= s.length() - t.length() i s.length() - t.length() s.length() s.length s t.length() t.length t i++ i++ i {
            int c = 0;
            for(int j = 0; j < t.length(); j++) {
                if(s.charAt(j+i) != t.charAt(j)) c++;
            }
            ans = Math.min(c, ans);
        } {
            int c = 0;
            for(int j = 0; j < t.length(); j++) {
                if(s.charAt(j+i) != t.charAt(j)) c++;
            }
            ans = Math.min(c, ans);
        } int c = 0; c 0 for(int j = 0; j < t.length(); j++) {
                if(s.charAt(j+i) != t.charAt(j)) c++;
            } int j = 0; int j = 0; j 0 j < t.length() j t.length() t.length t j++ j++ j {
                if(s.charAt(j+i) != t.charAt(j)) c++;
            } {
                if(s.charAt(j+i) != t.charAt(j)) c++;
            } if(s.charAt(j+i) != t.charAt(j)) c++; s.charAt(j+i) != t.charAt(j) s.charAt(j+i) s.charAt s j+i j i t.charAt(j) t.charAt t j c++ c ans = Math.min(c, ans) ans Math.min(c, ans) Math.min Math c ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args static class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next(){
            while(st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt(){
            return Integer.parseInt(next());
        }
        long nextLong(){
            return Long.parseLong(next());
        }
        double nextDouble(){
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            } catch (Exception e){
                e.printStackTrace();
            }
            return str;
        }
    } FastReader BufferedReader br; br StringTokenizer st; st public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        } FastReader {
            br = new BufferedReader(new InputStreamReader(System.in));
        } br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) String next(){
            while(st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        } next {
            while(st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        } while(st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e){
                    e.printStackTrace();
                }
            } st == null || !st.hasMoreElements() st == null st null !st.hasMoreElements() st.hasMoreElements() st.hasMoreElements st {
                try{
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e){
                    e.printStackTrace();
                }
            } try{
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e){
                    e.printStackTrace();
                } catch (IOException e){
                    e.printStackTrace();
                } IOException e {
                    e.printStackTrace();
                } e.printStackTrace() e.printStackTrace e {
                    st = new StringTokenizer(br.readLine());
                } st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int nextInt(){
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nextLong(){
            return Long.parseLong(next());
        } nextLong {
            return Long.parseLong(next());
        } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next double nextDouble(){
            return Double.parseDouble(next());
        } nextDouble {
            return Double.parseDouble(next());
        } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            } catch (Exception e){
                e.printStackTrace();
            }
            return str;
        } nextLine {
            String str = "";
            try{
                str = br.readLine();
            } catch (Exception e){
                e.printStackTrace();
            }
            return str;
        } String str = ""; str "" try{
                str = br.readLine();
            } catch (Exception e){
                e.printStackTrace();
            } catch (Exception e){
                e.printStackTrace();
            } Exception e {
                e.printStackTrace();
            } e.printStackTrace() e.printStackTrace e {
                str = br.readLine();
            } str = br.readLine() str br.readLine() br.readLine br return str; str static class pair{
        int first, second;
        pair(int first, int second){
            this.first = first;
            this.second = second;
        }
    } pair int first first second; second pair(int first, int second){
            this.first = first;
            this.second = second;
        } pair {
            this.first = first;
            this.second = second;
        } this.first = first this.first this this.first first this.second = second this.second this this.second second int first first int second second public class Main
{
    static class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next(){
            while(st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt(){
            return Integer.parseInt(next());
        }
        long nextLong(){
            return Long.parseLong(next());
        }
        double nextDouble(){
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            } catch (Exception e){
                e.printStackTrace();
            }
            return str;
        }
    }
    static int modPower(int x, int y, int mod){
        int res = 1;
        x %= mod;
        if(x==0) return 0;
        while(y>0){
            if(y%2==1){
                res = (res*x)%mod;
            }
            y = y>>1;
            x = (x*x)%mod;
        }
        return res;
    }
    public static int[] readArray(int n){
        FastReader in = new FastReader();
        int[] a = new int[n];
        for(int i = 0; i < n; i++) a[i] = in.nextInt();
        return a;
    }
    static class pair{
        int first, second;
        pair(int first, int second){
            this.first = first;
            this.second = second;
        }
    }
    public static void main (String[] args) throws java.lang.Exception
    {
        // your code goes here
        FastReader in = new FastReader();
        String s = in.nextLine(), t = in.nextLine();
        int ans = Integer.MAX_VALUE;
        for(int i = 0; i <= s.length() - t.length(); i++) {
            int c = 0;
            for(int j = 0; j < t.length(); j++) {
                if(s.charAt(j+i) != t.charAt(j)) c++;
            }
            ans = Math.min(c, ans);
        }
        System.out.println(ans);
    }
} public class Main
{
    static class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next(){
            while(st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt(){
            return Integer.parseInt(next());
        }
        long nextLong(){
            return Long.parseLong(next());
        }
        double nextDouble(){
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            } catch (Exception e){
                e.printStackTrace();
            }
            return str;
        }
    }
    static int modPower(int x, int y, int mod){
        int res = 1;
        x %= mod;
        if(x==0) return 0;
        while(y>0){
            if(y%2==1){
                res = (res*x)%mod;
            }
            y = y>>1;
            x = (x*x)%mod;
        }
        return res;
    }
    public static int[] readArray(int n){
        FastReader in = new FastReader();
        int[] a = new int[n];
        for(int i = 0; i < n; i++) a[i] = in.nextInt();
        return a;
    }
    static class pair{
        int first, second;
        pair(int first, int second){
            this.first = first;
            this.second = second;
        }
    }
    public static void main (String[] args) throws java.lang.Exception
    {
        // your code goes here
        FastReader in = new FastReader();
        String s = in.nextLine(), t = in.nextLine();
        int ans = Integer.MAX_VALUE;
        for(int i = 0; i <= s.length() - t.length(); i++) {
            int c = 0;
            for(int j = 0; j < t.length(); j++) {
                if(s.charAt(j+i) != t.charAt(j)) c++;
            }
            ans = Math.min(c, ans);
        }
        System.out.println(ans);
    }
} Main
// dont fuck with my love
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.stream.*;

public class Main
{
    static class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next(){
            while(st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt(){
            return Integer.parseInt(next());
        }
        long nextLong(){
            return Long.parseLong(next());
        }
        double nextDouble(){
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            } catch (Exception e){
                e.printStackTrace();
            }
            return str;
        }
    }
    static int modPower(int x, int y, int mod){
        int res = 1;
        x %= mod;
        if(x==0) return 0;
        while(y>0){
            if(y%2==1){
                res = (res*x)%mod;
            }
            y = y>>1;
            x = (x*x)%mod;
        }
        return res;
    }
    public static int[] readArray(int n){
        FastReader in = new FastReader();
        int[] a = new int[n];
        for(int i = 0; i < n; i++) a[i] = in.nextInt();
        return a;
    }
    static class pair{
        int first, second;
        pair(int first, int second){
            this.first = first;
            this.second = second;
        }
    }
    public static void main (String[] args) throws java.lang.Exception
    {
        // your code goes here
        FastReader in = new FastReader();
        String s = in.nextLine(), t = in.nextLine();
        int ans = Integer.MAX_VALUE;
        for(int i = 0; i <= s.length() - t.length(); i++) {
            int c = 0;
            for(int j = 0; j < t.length(); j++) {
                if(s.charAt(j+i) != t.charAt(j)) c++;
            }
            ans = Math.min(c, ans);
        }
        System.out.println(ans);
    }
}
