import java.io.*;
import java.util.*;
public class Main {
    static long startTime;
    static long endTime;
    static Boolean [] prime ;
    static int M=(int)1e9+7;
    static int MAX=Integer.MAX_VALUE;
    static int MIN=Integer.MIN_VALUE;
    static int SIZE = (int)1e9*2;
    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 (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    static void printArray(int[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void printArray(long[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void printArray(Integer[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void printArray(Long[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void yes(){
        System.out.println("YES");
    }
    static void no(){
        System.out.println("NO");
    }
    public static int lowerBound
            (Integer[] array, int length, int value) {
        // Returns the index of the value or
        // if there is no value, returns the closest to the left.
        int low=-1; // arr[low]<=tar
        int hi=length;//arr[hi]>tar
        while (low+1<hi){ // while pointers are not neighboring(low+1!=hi)
            int mid=(low+hi)/2;
            if(array[mid]<=value){
                low=mid;
            }
            else {
                hi=mid;
            }
        }
        return low;// if no such element, returns -1.
    }
    public static int upperBound(Integer[] array, int length, int value){
        // returns the index of the value or
        // if the value does not exist, returns the closest to the right
        int low=-1; // arr[low]<tar
        int hi=length;// arr[hi]>=tar
        while (low+1<hi){// Eventually, pointers should be adjacent.
            int mid=(low+hi)>>1;
            if(array[mid]>=value){
                hi=mid;
            }
            else low=mid;
        }
        return hi;
    }
    public  static  int binarySearch(Integer [] arr, int length, int value){
        // returns the index of the targeted value or -1 if there is no value.
        int low=0;
        int hi=length-1;
        int ans=-1;
        while (low<=hi){
            int mid=(low+hi)>>1;
            if(arr[mid]>value){
                hi=mid-1;
            }
            else if(arr[mid]<value){
                low=mid+1;
            }
            else {
                ans=mid;
                break;
            }
        }
        return ans;
    }
    public static long gcd(long a, long b){
        if (b == 0)
            return a;
        else return gcd(b, a % b);
    }
    public static long lcm(long a , long b){
        return a/gcd(a,b)*b;
    }
    public  static  long countDivs(long n ){
        int cn=0;
        long sqr = (long)Math.sqrt(n);
        for (long i = 1; i<=sqr ; ++i) {
            if(n%i==0){
                ++cn;
            }
        }
        cn*=2;
        if(sqr*sqr==n) cn--;
        return cn;

    }
    static void prime(int  x) {
        //sieve algorithm. nlog(log(n)).
        prime=new Boolean[ (x+1)];
        Arrays.fill(prime,true);
        prime[0] = prime[1] = false;
        for (int  i = 2; i * i <= x ; i++)
            if (prime[i])
                for (int  j = i * i; j <= x; j += i)
                    prime[j] = false;
    }
    static int[] sum;
    static void cumulitiveSum( int [] arr){
        sum = new int[arr.length];
        sum[0]=arr[0];
        for (int i = 1; i <arr.length; i++) {
            sum[i]=arr[i]+sum[i-1];
        }
    }
    static boolean isEven(long x ){
        return x % 2 == 0;
    }
    static boolean isPrime(long x ){
        boolean flag = true;
        int sqr = (int)Math.sqrt(x);
        if(x<2) return false;
        for (int i = 2; i <=sqr; i++) {
            if(x%i==0){
                flag=false;
                break;
            }
        }
        return flag;
    }
    static long factorial( long x) {
        long total = 1;
        for (int i = 2; i <= x; i++)
            total *= i;
        return total;
    }
    static long power(long x, long n) {
        if (n == 0) {
            return 1;
        }

        long pow = power(x, n / 2L);
        if ((n & 1) == 1) {
            return x * pow * pow;
        }

        return pow * pow;
    }

    public static void main(String [] args) {
        startTime = System.currentTimeMillis();
         // int T = sc.nextInt();while (T--!=0)
        {
            solve();
        }
        endTime = System.currentTimeMillis();
        long duration= endTime-startTime;
        //System.out.println(duration);
    }

    // static Scanner sc = new Scanner(System.in);

    static FastReader sc = new FastReader();
    public static void solve()  {
//////////////////////////////////////////////////////////////////////
        String s = sc.next(),t=sc.next();
        int ss=s.length(),tt=t.length();
        int match;
        int max_match=0;
        for (int i = 0; i <=ss-tt; i++) {
            match=0;
            int k=i;
            for (int j = 0; j < tt; j++) {
                if(s.charAt(k)==t.charAt(j)){
                    match++;
                }
                k++;
            }
            max_match=Math.max(max_match,match);
        }
        System.out.println(tt-max_match);
///////////////////////////////////////////////////////////////////////
    }

} import java.io.*; io.* java import java.util.*; util.* java public class Main {
    static long startTime;
    static long endTime;
    static Boolean [] prime ;
    static int M=(int)1e9+7;
    static int MAX=Integer.MAX_VALUE;
    static int MIN=Integer.MIN_VALUE;
    static int SIZE = (int)1e9*2;
    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 (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    static void printArray(int[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void printArray(long[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void printArray(Integer[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void printArray(Long[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void yes(){
        System.out.println("YES");
    }
    static void no(){
        System.out.println("NO");
    }
    public static int lowerBound
            (Integer[] array, int length, int value) {
        // Returns the index of the value or
        // if there is no value, returns the closest to the left.
        int low=-1; // arr[low]<=tar
        int hi=length;//arr[hi]>tar
        while (low+1<hi){ // while pointers are not neighboring(low+1!=hi)
            int mid=(low+hi)/2;
            if(array[mid]<=value){
                low=mid;
            }
            else {
                hi=mid;
            }
        }
        return low;// if no such element, returns -1.
    }
    public static int upperBound(Integer[] array, int length, int value){
        // returns the index of the value or
        // if the value does not exist, returns the closest to the right
        int low=-1; // arr[low]<tar
        int hi=length;// arr[hi]>=tar
        while (low+1<hi){// Eventually, pointers should be adjacent.
            int mid=(low+hi)>>1;
            if(array[mid]>=value){
                hi=mid;
            }
            else low=mid;
        }
        return hi;
    }
    public  static  int binarySearch(Integer [] arr, int length, int value){
        // returns the index of the targeted value or -1 if there is no value.
        int low=0;
        int hi=length-1;
        int ans=-1;
        while (low<=hi){
            int mid=(low+hi)>>1;
            if(arr[mid]>value){
                hi=mid-1;
            }
            else if(arr[mid]<value){
                low=mid+1;
            }
            else {
                ans=mid;
                break;
            }
        }
        return ans;
    }
    public static long gcd(long a, long b){
        if (b == 0)
            return a;
        else return gcd(b, a % b);
    }
    public static long lcm(long a , long b){
        return a/gcd(a,b)*b;
    }
    public  static  long countDivs(long n ){
        int cn=0;
        long sqr = (long)Math.sqrt(n);
        for (long i = 1; i<=sqr ; ++i) {
            if(n%i==0){
                ++cn;
            }
        }
        cn*=2;
        if(sqr*sqr==n) cn--;
        return cn;

    }
    static void prime(int  x) {
        //sieve algorithm. nlog(log(n)).
        prime=new Boolean[ (x+1)];
        Arrays.fill(prime,true);
        prime[0] = prime[1] = false;
        for (int  i = 2; i * i <= x ; i++)
            if (prime[i])
                for (int  j = i * i; j <= x; j += i)
                    prime[j] = false;
    }
    static int[] sum;
    static void cumulitiveSum( int [] arr){
        sum = new int[arr.length];
        sum[0]=arr[0];
        for (int i = 1; i <arr.length; i++) {
            sum[i]=arr[i]+sum[i-1];
        }
    }
    static boolean isEven(long x ){
        return x % 2 == 0;
    }
    static boolean isPrime(long x ){
        boolean flag = true;
        int sqr = (int)Math.sqrt(x);
        if(x<2) return false;
        for (int i = 2; i <=sqr; i++) {
            if(x%i==0){
                flag=false;
                break;
            }
        }
        return flag;
    }
    static long factorial( long x) {
        long total = 1;
        for (int i = 2; i <= x; i++)
            total *= i;
        return total;
    }
    static long power(long x, long n) {
        if (n == 0) {
            return 1;
        }

        long pow = power(x, n / 2L);
        if ((n & 1) == 1) {
            return x * pow * pow;
        }

        return pow * pow;
    }

    public static void main(String [] args) {
        startTime = System.currentTimeMillis();
         // int T = sc.nextInt();while (T--!=0)
        {
            solve();
        }
        endTime = System.currentTimeMillis();
        long duration= endTime-startTime;
        //System.out.println(duration);
    }

    // static Scanner sc = new Scanner(System.in);

    static FastReader sc = new FastReader();
    public static void solve()  {
//////////////////////////////////////////////////////////////////////
        String s = sc.next(),t=sc.next();
        int ss=s.length(),tt=t.length();
        int match;
        int max_match=0;
        for (int i = 0; i <=ss-tt; i++) {
            match=0;
            int k=i;
            for (int j = 0; j < tt; j++) {
                if(s.charAt(k)==t.charAt(j)){
                    match++;
                }
                k++;
            }
            max_match=Math.max(max_match,match);
        }
        System.out.println(tt-max_match);
///////////////////////////////////////////////////////////////////////
    }

} Main static long startTime; startTime static long endTime; endTime static Boolean [] prime ; prime static int M=(int)1e9+7; M (int)1e9+7 (int)1e9 7 static int MAX=Integer.MAX_VALUE; MAX Integer.MAX_VALUE Integer Integer.MAX_VALUE static int MIN=Integer.MIN_VALUE; MIN Integer.MIN_VALUE Integer Integer.MIN_VALUE static int SIZE = (int)1e9*2; SIZE (int)1e9*2 (int)1e9 2 static int[] sum; sum static FastReader sc = new FastReader(); sc new FastReader() static void printArray(int[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    } printArray {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    } int n = arr.length; n arr.length arr arr.length for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " "); int i = 0; int i = 0; i 0 i < n i n ++i ++i i System.out.print(arr[i] + " "); System.out.print(arr[i] + " ") System.out.print System.out System System.out arr[i] + " " arr[i] arr i " " System.out.println() System.out.println System.out System System.out int[] arr arr static void printArray(long[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    } printArray {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    } int n = arr.length; n arr.length arr arr.length for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " "); int i = 0; int i = 0; i 0 i < n i n ++i ++i i System.out.print(arr[i] + " "); System.out.print(arr[i] + " ") System.out.print System.out System System.out arr[i] + " " arr[i] arr i " " System.out.println() System.out.println System.out System System.out long[] arr arr static void printArray(Integer[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    } printArray {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    } int n = arr.length; n arr.length arr arr.length for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " "); int i = 0; int i = 0; i 0 i < n i n ++i ++i i System.out.print(arr[i] + " "); System.out.print(arr[i] + " ") System.out.print System.out System System.out arr[i] + " " arr[i] arr i " " System.out.println() System.out.println System.out System System.out Integer[] arr arr static void printArray(Long[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    } printArray {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    } int n = arr.length; n arr.length arr arr.length for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " "); int i = 0; int i = 0; i 0 i < n i n ++i ++i i System.out.print(arr[i] + " "); System.out.print(arr[i] + " ") System.out.print System.out System System.out arr[i] + " " arr[i] arr i " " System.out.println() System.out.println System.out System System.out Long[] arr arr static void yes(){
        System.out.println("YES");
    } yes {
        System.out.println("YES");
    } System.out.println("YES") System.out.println System.out System System.out "YES" static void no(){
        System.out.println("NO");
    } no {
        System.out.println("NO");
    } System.out.println("NO") System.out.println System.out System System.out "NO" public static int lowerBound
            (Integer[] array, int length, int value) {
        // Returns the index of the value or
        // if there is no value, returns the closest to the left.
        int low=-1; // arr[low]<=tar
        int hi=length;//arr[hi]>tar
        while (low+1<hi){ // while pointers are not neighboring(low+1!=hi)
            int mid=(low+hi)/2;
            if(array[mid]<=value){
                low=mid;
            }
            else {
                hi=mid;
            }
        }
        return low;// if no such element, returns -1.
    } lowerBound {
        // Returns the index of the value or
        // if there is no value, returns the closest to the left.
        int low=-1; // arr[low]<=tar
        int hi=length;//arr[hi]>tar
        while (low+1<hi){ // while pointers are not neighboring(low+1!=hi)
            int mid=(low+hi)/2;
            if(array[mid]<=value){
                low=mid;
            }
            else {
                hi=mid;
            }
        }
        return low;// if no such element, returns -1.
    } int low=-1; low -1 1 int hi=length; hi length while (low+1<hi){ // while pointers are not neighboring(low+1!=hi)
            int mid=(low+hi)/2;
            if(array[mid]<=value){
                low=mid;
            }
            else {
                hi=mid;
            }
        } low+1<hi low+1 low 1 hi { // while pointers are not neighboring(low+1!=hi)
            int mid=(low+hi)/2;
            if(array[mid]<=value){
                low=mid;
            }
            else {
                hi=mid;
            }
        } int mid=(low+hi)/2; mid (low+hi)/2 (low+hi) low hi 2 if(array[mid]<=value){
                low=mid;
            }
            else {
                hi=mid;
            } array[mid]<=value array[mid] array mid value {
                low=mid;
            } low=mid low mid {
                hi=mid;
            } hi=mid hi mid return low;// if no such element, returns -1. low Integer[] array array int length length int value value public static int upperBound(Integer[] array, int length, int value){
        // returns the index of the value or
        // if the value does not exist, returns the closest to the right
        int low=-1; // arr[low]<tar
        int hi=length;// arr[hi]>=tar
        while (low+1<hi){// Eventually, pointers should be adjacent.
            int mid=(low+hi)>>1;
            if(array[mid]>=value){
                hi=mid;
            }
            else low=mid;
        }
        return hi;
    } upperBound {
        // returns the index of the value or
        // if the value does not exist, returns the closest to the right
        int low=-1; // arr[low]<tar
        int hi=length;// arr[hi]>=tar
        while (low+1<hi){// Eventually, pointers should be adjacent.
            int mid=(low+hi)>>1;
            if(array[mid]>=value){
                hi=mid;
            }
            else low=mid;
        }
        return hi;
    } int low=-1; low -1 1 int hi=length; hi length while (low+1<hi){// Eventually, pointers should be adjacent.
            int mid=(low+hi)>>1;
            if(array[mid]>=value){
                hi=mid;
            }
            else low=mid;
        } low+1<hi low+1 low 1 hi {// Eventually, pointers should be adjacent.
            int mid=(low+hi)>>1;
            if(array[mid]>=value){
                hi=mid;
            }
            else low=mid;
        } int mid=(low+hi)>>1; mid (low+hi)>>1 (low+hi) low hi 1 if(array[mid]>=value){
                hi=mid;
            }
            else low=mid; array[mid]>=value array[mid] array mid value {
                hi=mid;
            } hi=mid hi mid low=mid low mid return hi; hi Integer[] array array int length length int value value public  static  int binarySearch(Integer [] arr, int length, int value){
        // returns the index of the targeted value or -1 if there is no value.
        int low=0;
        int hi=length-1;
        int ans=-1;
        while (low<=hi){
            int mid=(low+hi)>>1;
            if(arr[mid]>value){
                hi=mid-1;
            }
            else if(arr[mid]<value){
                low=mid+1;
            }
            else {
                ans=mid;
                break;
            }
        }
        return ans;
    } binarySearch {
        // returns the index of the targeted value or -1 if there is no value.
        int low=0;
        int hi=length-1;
        int ans=-1;
        while (low<=hi){
            int mid=(low+hi)>>1;
            if(arr[mid]>value){
                hi=mid-1;
            }
            else if(arr[mid]<value){
                low=mid+1;
            }
            else {
                ans=mid;
                break;
            }
        }
        return ans;
    } int low=0; low 0 int hi=length-1; hi length-1 length 1 int ans=-1; ans -1 1 while (low<=hi){
            int mid=(low+hi)>>1;
            if(arr[mid]>value){
                hi=mid-1;
            }
            else if(arr[mid]<value){
                low=mid+1;
            }
            else {
                ans=mid;
                break;
            }
        } low<=hi low hi {
            int mid=(low+hi)>>1;
            if(arr[mid]>value){
                hi=mid-1;
            }
            else if(arr[mid]<value){
                low=mid+1;
            }
            else {
                ans=mid;
                break;
            }
        } int mid=(low+hi)>>1; mid (low+hi)>>1 (low+hi) low hi 1 if(arr[mid]>value){
                hi=mid-1;
            }
            else if(arr[mid]<value){
                low=mid+1;
            }
            else {
                ans=mid;
                break;
            } arr[mid]>value arr[mid] arr mid value {
                hi=mid-1;
            } hi=mid-1 hi mid-1 mid 1 if(arr[mid]<value){
                low=mid+1;
            }
            else {
                ans=mid;
                break;
            } arr[mid]<value arr[mid] arr mid value {
                low=mid+1;
            } low=mid+1 low mid+1 mid 1 {
                ans=mid;
                break;
            } ans=mid ans mid break; return ans; ans Integer [] arr arr int length length int value value public static long gcd(long a, long b){
        if (b == 0)
            return a;
        else return gcd(b, a % b);
    } gcd {
        if (b == 0)
            return a;
        else return gcd(b, a % b);
    } if (b == 0)
            return a;
        else return gcd(b, a % b); b == 0 b 0 return a; a return gcd(b, a % b); gcd(b, a % b) gcd b a % b a b long a a long b b public static long lcm(long a , long b){
        return a/gcd(a,b)*b;
    } lcm {
        return a/gcd(a,b)*b;
    } return a/gcd(a,b)*b; a/gcd(a,b)*b a/gcd(a,b) a gcd(a,b) gcd a b b long a a long b b public  static  long countDivs(long n ){
        int cn=0;
        long sqr = (long)Math.sqrt(n);
        for (long i = 1; i<=sqr ; ++i) {
            if(n%i==0){
                ++cn;
            }
        }
        cn*=2;
        if(sqr*sqr==n) cn--;
        return cn;

    } countDivs {
        int cn=0;
        long sqr = (long)Math.sqrt(n);
        for (long i = 1; i<=sqr ; ++i) {
            if(n%i==0){
                ++cn;
            }
        }
        cn*=2;
        if(sqr*sqr==n) cn--;
        return cn;

    } int cn=0; cn 0 long sqr = (long)Math.sqrt(n); sqr (long)Math.sqrt(n) Math.sqrt Math n for (long i = 1; i<=sqr ; ++i) {
            if(n%i==0){
                ++cn;
            }
        } long i = 1; long i = 1; i 1 i<=sqr i sqr ++i ++i i {
            if(n%i==0){
                ++cn;
            }
        } {
            if(n%i==0){
                ++cn;
            }
        } if(n%i==0){
                ++cn;
            } n%i==0 n%i n i 0 {
                ++cn;
            } ++cn cn cn*=2 cn 2 if(sqr*sqr==n) cn--; sqr*sqr==n sqr*sqr sqr sqr n cn-- cn return cn; cn long n n static void prime(int  x) {
        //sieve algorithm. nlog(log(n)).
        prime=new Boolean[ (x+1)];
        Arrays.fill(prime,true);
        prime[0] = prime[1] = false;
        for (int  i = 2; i * i <= x ; i++)
            if (prime[i])
                for (int  j = i * i; j <= x; j += i)
                    prime[j] = false;
    } prime {
        //sieve algorithm. nlog(log(n)).
        prime=new Boolean[ (x+1)];
        Arrays.fill(prime,true);
        prime[0] = prime[1] = false;
        for (int  i = 2; i * i <= x ; i++)
            if (prime[i])
                for (int  j = i * i; j <= x; j += i)
                    prime[j] = false;
    } prime=new Boolean[ (x+1)] prime new Boolean[ (x+1)] (x+1) x 1 Arrays.fill(prime,true) Arrays.fill Arrays prime true prime[0] = prime[1] = false prime[0] prime 0 prime[1] = false prime[1] prime 1 false for (int  i = 2; i * i <= x ; i++)
            if (prime[i])
                for (int  j = i * i; j <= x; j += i)
                    prime[j] = false; int  i = 2; int  i = 2; i 2 i * i <= x i * i i i x i++ i++ i if (prime[i])
                for (int  j = i * i; j <= x; j += i)
                    prime[j] = false; if (prime[i])
                for (int  j = i * i; j <= x; j += i)
                    prime[j] = false; prime[i] prime i for (int  j = i * i; j <= x; j += i)
                    prime[j] = false; int  j = i * i; int  j = i * i; j i * i i i j <= x j x j += i j += i j i prime[j] = false; prime[j] = false prime[j] prime j false int  x x static void cumulitiveSum( int [] arr){
        sum = new int[arr.length];
        sum[0]=arr[0];
        for (int i = 1; i <arr.length; i++) {
            sum[i]=arr[i]+sum[i-1];
        }
    } cumulitiveSum {
        sum = new int[arr.length];
        sum[0]=arr[0];
        for (int i = 1; i <arr.length; i++) {
            sum[i]=arr[i]+sum[i-1];
        }
    } sum = new int[arr.length] sum new int[arr.length] arr.length arr arr.length sum[0]=arr[0] sum[0] sum 0 arr[0] arr 0 for (int i = 1; i <arr.length; i++) {
            sum[i]=arr[i]+sum[i-1];
        } int i = 1; int i = 1; i 1 i <arr.length i arr.length arr arr.length i++ i++ i {
            sum[i]=arr[i]+sum[i-1];
        } {
            sum[i]=arr[i]+sum[i-1];
        } sum[i]=arr[i]+sum[i-1] sum[i] sum i arr[i]+sum[i-1] arr[i] arr i sum[i-1] sum i-1 i 1 int [] arr arr static boolean isEven(long x ){
        return x % 2 == 0;
    } isEven {
        return x % 2 == 0;
    } return x % 2 == 0; x % 2 == 0 x % 2 x 2 0 long x x static boolean isPrime(long x ){
        boolean flag = true;
        int sqr = (int)Math.sqrt(x);
        if(x<2) return false;
        for (int i = 2; i <=sqr; i++) {
            if(x%i==0){
                flag=false;
                break;
            }
        }
        return flag;
    } isPrime {
        boolean flag = true;
        int sqr = (int)Math.sqrt(x);
        if(x<2) return false;
        for (int i = 2; i <=sqr; i++) {
            if(x%i==0){
                flag=false;
                break;
            }
        }
        return flag;
    } boolean flag = true; flag true int sqr = (int)Math.sqrt(x); sqr (int)Math.sqrt(x) Math.sqrt Math x if(x<2) return false; x<2 x 2 return false; false for (int i = 2; i <=sqr; i++) {
            if(x%i==0){
                flag=false;
                break;
            }
        } int i = 2; int i = 2; i 2 i <=sqr i sqr i++ i++ i {
            if(x%i==0){
                flag=false;
                break;
            }
        } {
            if(x%i==0){
                flag=false;
                break;
            }
        } if(x%i==0){
                flag=false;
                break;
            } x%i==0 x%i x i 0 {
                flag=false;
                break;
            } flag=false flag false break; return flag; flag long x x static long factorial( long x) {
        long total = 1;
        for (int i = 2; i <= x; i++)
            total *= i;
        return total;
    } factorial {
        long total = 1;
        for (int i = 2; i <= x; i++)
            total *= i;
        return total;
    } long total = 1; total 1 for (int i = 2; i <= x; i++)
            total *= i; int i = 2; int i = 2; i 2 i <= x i x i++ i++ i total *= i; total *= i total i return total; total long x x static long power(long x, long n) {
        if (n == 0) {
            return 1;
        }

        long pow = power(x, n / 2L);
        if ((n & 1) == 1) {
            return x * pow * pow;
        }

        return pow * pow;
    } power {
        if (n == 0) {
            return 1;
        }

        long pow = power(x, n / 2L);
        if ((n & 1) == 1) {
            return x * pow * pow;
        }

        return pow * pow;
    } if (n == 0) {
            return 1;
        } n == 0 n 0 {
            return 1;
        } return 1; 1 long pow = power(x, n / 2L); pow power(x, n / 2L) power x n / 2L n 2L if ((n & 1) == 1) {
            return x * pow * pow;
        } (n & 1) == 1 (n & 1) n 1 1 {
            return x * pow * pow;
        } return x * pow * pow; x * pow * pow x * pow * pow x pow pow return pow * pow; pow * pow pow pow long x x long n n public static void main(String [] args) {
        startTime = System.currentTimeMillis();
         // int T = sc.nextInt();while (T--!=0)
        {
            solve();
        }
        endTime = System.currentTimeMillis();
        long duration= endTime-startTime;
        //System.out.println(duration);
    } main {
        startTime = System.currentTimeMillis();
         // int T = sc.nextInt();while (T--!=0)
        {
            solve();
        }
        endTime = System.currentTimeMillis();
        long duration= endTime-startTime;
        //System.out.println(duration);
    } startTime = System.currentTimeMillis() startTime System.currentTimeMillis() System.currentTimeMillis System {
            solve();
        } solve() solve endTime = System.currentTimeMillis() endTime System.currentTimeMillis() System.currentTimeMillis System long duration= endTime-startTime; duration endTime-startTime endTime startTime String [] args args public static void solve()  {
//////////////////////////////////////////////////////////////////////
        String s = sc.next(),t=sc.next();
        int ss=s.length(),tt=t.length();
        int match;
        int max_match=0;
        for (int i = 0; i <=ss-tt; i++) {
            match=0;
            int k=i;
            for (int j = 0; j < tt; j++) {
                if(s.charAt(k)==t.charAt(j)){
                    match++;
                }
                k++;
            }
            max_match=Math.max(max_match,match);
        }
        System.out.println(tt-max_match);
///////////////////////////////////////////////////////////////////////
    } solve {
//////////////////////////////////////////////////////////////////////
        String s = sc.next(),t=sc.next();
        int ss=s.length(),tt=t.length();
        int match;
        int max_match=0;
        for (int i = 0; i <=ss-tt; i++) {
            match=0;
            int k=i;
            for (int j = 0; j < tt; j++) {
                if(s.charAt(k)==t.charAt(j)){
                    match++;
                }
                k++;
            }
            max_match=Math.max(max_match,match);
        }
        System.out.println(tt-max_match);
///////////////////////////////////////////////////////////////////////
    } String s = sc.next() s sc.next() sc.next sc t=sc.next(); t sc.next() sc.next sc int ss=s.length() ss s.length() s.length s tt=t.length(); tt t.length() t.length t int match; match int max_match=0; max_match 0 for (int i = 0; i <=ss-tt; i++) {
            match=0;
            int k=i;
            for (int j = 0; j < tt; j++) {
                if(s.charAt(k)==t.charAt(j)){
                    match++;
                }
                k++;
            }
            max_match=Math.max(max_match,match);
        } int i = 0; int i = 0; i 0 i <=ss-tt i ss-tt ss tt i++ i++ i {
            match=0;
            int k=i;
            for (int j = 0; j < tt; j++) {
                if(s.charAt(k)==t.charAt(j)){
                    match++;
                }
                k++;
            }
            max_match=Math.max(max_match,match);
        } {
            match=0;
            int k=i;
            for (int j = 0; j < tt; j++) {
                if(s.charAt(k)==t.charAt(j)){
                    match++;
                }
                k++;
            }
            max_match=Math.max(max_match,match);
        } match=0 match 0 int k=i; k i for (int j = 0; j < tt; j++) {
                if(s.charAt(k)==t.charAt(j)){
                    match++;
                }
                k++;
            } int j = 0; int j = 0; j 0 j < tt j tt j++ j++ j {
                if(s.charAt(k)==t.charAt(j)){
                    match++;
                }
                k++;
            } {
                if(s.charAt(k)==t.charAt(j)){
                    match++;
                }
                k++;
            } if(s.charAt(k)==t.charAt(j)){
                    match++;
                } s.charAt(k)==t.charAt(j) s.charAt(k) s.charAt s k t.charAt(j) t.charAt t j {
                    match++;
                } match++ match k++ k max_match=Math.max(max_match,match) max_match Math.max(max_match,match) Math.max Math max_match match System.out.println(tt-max_match) System.out.println System.out System System.out tt-max_match tt max_match 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 (IOException 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 (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        } nextLine {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        } String str = ""; str "" try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            } catch (IOException e)
            {
                e.printStackTrace();
            } IOException e {
                e.printStackTrace();
            } e.printStackTrace() e.printStackTrace e {
                str = br.readLine();
            } str = br.readLine() str br.readLine() br.readLine br return str; str public class Main {
    static long startTime;
    static long endTime;
    static Boolean [] prime ;
    static int M=(int)1e9+7;
    static int MAX=Integer.MAX_VALUE;
    static int MIN=Integer.MIN_VALUE;
    static int SIZE = (int)1e9*2;
    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 (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    static void printArray(int[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void printArray(long[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void printArray(Integer[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void printArray(Long[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void yes(){
        System.out.println("YES");
    }
    static void no(){
        System.out.println("NO");
    }
    public static int lowerBound
            (Integer[] array, int length, int value) {
        // Returns the index of the value or
        // if there is no value, returns the closest to the left.
        int low=-1; // arr[low]<=tar
        int hi=length;//arr[hi]>tar
        while (low+1<hi){ // while pointers are not neighboring(low+1!=hi)
            int mid=(low+hi)/2;
            if(array[mid]<=value){
                low=mid;
            }
            else {
                hi=mid;
            }
        }
        return low;// if no such element, returns -1.
    }
    public static int upperBound(Integer[] array, int length, int value){
        // returns the index of the value or
        // if the value does not exist, returns the closest to the right
        int low=-1; // arr[low]<tar
        int hi=length;// arr[hi]>=tar
        while (low+1<hi){// Eventually, pointers should be adjacent.
            int mid=(low+hi)>>1;
            if(array[mid]>=value){
                hi=mid;
            }
            else low=mid;
        }
        return hi;
    }
    public  static  int binarySearch(Integer [] arr, int length, int value){
        // returns the index of the targeted value or -1 if there is no value.
        int low=0;
        int hi=length-1;
        int ans=-1;
        while (low<=hi){
            int mid=(low+hi)>>1;
            if(arr[mid]>value){
                hi=mid-1;
            }
            else if(arr[mid]<value){
                low=mid+1;
            }
            else {
                ans=mid;
                break;
            }
        }
        return ans;
    }
    public static long gcd(long a, long b){
        if (b == 0)
            return a;
        else return gcd(b, a % b);
    }
    public static long lcm(long a , long b){
        return a/gcd(a,b)*b;
    }
    public  static  long countDivs(long n ){
        int cn=0;
        long sqr = (long)Math.sqrt(n);
        for (long i = 1; i<=sqr ; ++i) {
            if(n%i==0){
                ++cn;
            }
        }
        cn*=2;
        if(sqr*sqr==n) cn--;
        return cn;

    }
    static void prime(int  x) {
        //sieve algorithm. nlog(log(n)).
        prime=new Boolean[ (x+1)];
        Arrays.fill(prime,true);
        prime[0] = prime[1] = false;
        for (int  i = 2; i * i <= x ; i++)
            if (prime[i])
                for (int  j = i * i; j <= x; j += i)
                    prime[j] = false;
    }
    static int[] sum;
    static void cumulitiveSum( int [] arr){
        sum = new int[arr.length];
        sum[0]=arr[0];
        for (int i = 1; i <arr.length; i++) {
            sum[i]=arr[i]+sum[i-1];
        }
    }
    static boolean isEven(long x ){
        return x % 2 == 0;
    }
    static boolean isPrime(long x ){
        boolean flag = true;
        int sqr = (int)Math.sqrt(x);
        if(x<2) return false;
        for (int i = 2; i <=sqr; i++) {
            if(x%i==0){
                flag=false;
                break;
            }
        }
        return flag;
    }
    static long factorial( long x) {
        long total = 1;
        for (int i = 2; i <= x; i++)
            total *= i;
        return total;
    }
    static long power(long x, long n) {
        if (n == 0) {
            return 1;
        }

        long pow = power(x, n / 2L);
        if ((n & 1) == 1) {
            return x * pow * pow;
        }

        return pow * pow;
    }

    public static void main(String [] args) {
        startTime = System.currentTimeMillis();
         // int T = sc.nextInt();while (T--!=0)
        {
            solve();
        }
        endTime = System.currentTimeMillis();
        long duration= endTime-startTime;
        //System.out.println(duration);
    }

    // static Scanner sc = new Scanner(System.in);

    static FastReader sc = new FastReader();
    public static void solve()  {
//////////////////////////////////////////////////////////////////////
        String s = sc.next(),t=sc.next();
        int ss=s.length(),tt=t.length();
        int match;
        int max_match=0;
        for (int i = 0; i <=ss-tt; i++) {
            match=0;
            int k=i;
            for (int j = 0; j < tt; j++) {
                if(s.charAt(k)==t.charAt(j)){
                    match++;
                }
                k++;
            }
            max_match=Math.max(max_match,match);
        }
        System.out.println(tt-max_match);
///////////////////////////////////////////////////////////////////////
    }

} public class Main {
    static long startTime;
    static long endTime;
    static Boolean [] prime ;
    static int M=(int)1e9+7;
    static int MAX=Integer.MAX_VALUE;
    static int MIN=Integer.MIN_VALUE;
    static int SIZE = (int)1e9*2;
    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 (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    static void printArray(int[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void printArray(long[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void printArray(Integer[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void printArray(Long[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void yes(){
        System.out.println("YES");
    }
    static void no(){
        System.out.println("NO");
    }
    public static int lowerBound
            (Integer[] array, int length, int value) {
        // Returns the index of the value or
        // if there is no value, returns the closest to the left.
        int low=-1; // arr[low]<=tar
        int hi=length;//arr[hi]>tar
        while (low+1<hi){ // while pointers are not neighboring(low+1!=hi)
            int mid=(low+hi)/2;
            if(array[mid]<=value){
                low=mid;
            }
            else {
                hi=mid;
            }
        }
        return low;// if no such element, returns -1.
    }
    public static int upperBound(Integer[] array, int length, int value){
        // returns the index of the value or
        // if the value does not exist, returns the closest to the right
        int low=-1; // arr[low]<tar
        int hi=length;// arr[hi]>=tar
        while (low+1<hi){// Eventually, pointers should be adjacent.
            int mid=(low+hi)>>1;
            if(array[mid]>=value){
                hi=mid;
            }
            else low=mid;
        }
        return hi;
    }
    public  static  int binarySearch(Integer [] arr, int length, int value){
        // returns the index of the targeted value or -1 if there is no value.
        int low=0;
        int hi=length-1;
        int ans=-1;
        while (low<=hi){
            int mid=(low+hi)>>1;
            if(arr[mid]>value){
                hi=mid-1;
            }
            else if(arr[mid]<value){
                low=mid+1;
            }
            else {
                ans=mid;
                break;
            }
        }
        return ans;
    }
    public static long gcd(long a, long b){
        if (b == 0)
            return a;
        else return gcd(b, a % b);
    }
    public static long lcm(long a , long b){
        return a/gcd(a,b)*b;
    }
    public  static  long countDivs(long n ){
        int cn=0;
        long sqr = (long)Math.sqrt(n);
        for (long i = 1; i<=sqr ; ++i) {
            if(n%i==0){
                ++cn;
            }
        }
        cn*=2;
        if(sqr*sqr==n) cn--;
        return cn;

    }
    static void prime(int  x) {
        //sieve algorithm. nlog(log(n)).
        prime=new Boolean[ (x+1)];
        Arrays.fill(prime,true);
        prime[0] = prime[1] = false;
        for (int  i = 2; i * i <= x ; i++)
            if (prime[i])
                for (int  j = i * i; j <= x; j += i)
                    prime[j] = false;
    }
    static int[] sum;
    static void cumulitiveSum( int [] arr){
        sum = new int[arr.length];
        sum[0]=arr[0];
        for (int i = 1; i <arr.length; i++) {
            sum[i]=arr[i]+sum[i-1];
        }
    }
    static boolean isEven(long x ){
        return x % 2 == 0;
    }
    static boolean isPrime(long x ){
        boolean flag = true;
        int sqr = (int)Math.sqrt(x);
        if(x<2) return false;
        for (int i = 2; i <=sqr; i++) {
            if(x%i==0){
                flag=false;
                break;
            }
        }
        return flag;
    }
    static long factorial( long x) {
        long total = 1;
        for (int i = 2; i <= x; i++)
            total *= i;
        return total;
    }
    static long power(long x, long n) {
        if (n == 0) {
            return 1;
        }

        long pow = power(x, n / 2L);
        if ((n & 1) == 1) {
            return x * pow * pow;
        }

        return pow * pow;
    }

    public static void main(String [] args) {
        startTime = System.currentTimeMillis();
         // int T = sc.nextInt();while (T--!=0)
        {
            solve();
        }
        endTime = System.currentTimeMillis();
        long duration= endTime-startTime;
        //System.out.println(duration);
    }

    // static Scanner sc = new Scanner(System.in);

    static FastReader sc = new FastReader();
    public static void solve()  {
//////////////////////////////////////////////////////////////////////
        String s = sc.next(),t=sc.next();
        int ss=s.length(),tt=t.length();
        int match;
        int max_match=0;
        for (int i = 0; i <=ss-tt; i++) {
            match=0;
            int k=i;
            for (int j = 0; j < tt; j++) {
                if(s.charAt(k)==t.charAt(j)){
                    match++;
                }
                k++;
            }
            max_match=Math.max(max_match,match);
        }
        System.out.println(tt-max_match);
///////////////////////////////////////////////////////////////////////
    }

} Main
import java.io.*;
import java.util.*;
public class Main {
    static long startTime;
    static long endTime;
    static Boolean [] prime ;
    static int M=(int)1e9+7;
    static int MAX=Integer.MAX_VALUE;
    static int MIN=Integer.MIN_VALUE;
    static int SIZE = (int)1e9*2;
    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 (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    static void printArray(int[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void printArray(long[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void printArray(Integer[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void printArray(Long[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void yes(){
        System.out.println("YES");
    }
    static void no(){
        System.out.println("NO");
    }
    public static int lowerBound
            (Integer[] array, int length, int value) {
        // Returns the index of the value or
        // if there is no value, returns the closest to the left.
        int low=-1; // arr[low]<=tar
        int hi=length;//arr[hi]>tar
        while (low+1<hi){ // while pointers are not neighboring(low+1!=hi)
            int mid=(low+hi)/2;
            if(array[mid]<=value){
                low=mid;
            }
            else {
                hi=mid;
            }
        }
        return low;// if no such element, returns -1.
    }
    public static int upperBound(Integer[] array, int length, int value){
        // returns the index of the value or
        // if the value does not exist, returns the closest to the right
        int low=-1; // arr[low]<tar
        int hi=length;// arr[hi]>=tar
        while (low+1<hi){// Eventually, pointers should be adjacent.
            int mid=(low+hi)>>1;
            if(array[mid]>=value){
                hi=mid;
            }
            else low=mid;
        }
        return hi;
    }
    public  static  int binarySearch(Integer [] arr, int length, int value){
        // returns the index of the targeted value or -1 if there is no value.
        int low=0;
        int hi=length-1;
        int ans=-1;
        while (low<=hi){
            int mid=(low+hi)>>1;
            if(arr[mid]>value){
                hi=mid-1;
            }
            else if(arr[mid]<value){
                low=mid+1;
            }
            else {
                ans=mid;
                break;
            }
        }
        return ans;
    }
    public static long gcd(long a, long b){
        if (b == 0)
            return a;
        else return gcd(b, a % b);
    }
    public static long lcm(long a , long b){
        return a/gcd(a,b)*b;
    }
    public  static  long countDivs(long n ){
        int cn=0;
        long sqr = (long)Math.sqrt(n);
        for (long i = 1; i<=sqr ; ++i) {
            if(n%i==0){
                ++cn;
            }
        }
        cn*=2;
        if(sqr*sqr==n) cn--;
        return cn;

    }
    static void prime(int  x) {
        //sieve algorithm. nlog(log(n)).
        prime=new Boolean[ (x+1)];
        Arrays.fill(prime,true);
        prime[0] = prime[1] = false;
        for (int  i = 2; i * i <= x ; i++)
            if (prime[i])
                for (int  j = i * i; j <= x; j += i)
                    prime[j] = false;
    }
    static int[] sum;
    static void cumulitiveSum( int [] arr){
        sum = new int[arr.length];
        sum[0]=arr[0];
        for (int i = 1; i <arr.length; i++) {
            sum[i]=arr[i]+sum[i-1];
        }
    }
    static boolean isEven(long x ){
        return x % 2 == 0;
    }
    static boolean isPrime(long x ){
        boolean flag = true;
        int sqr = (int)Math.sqrt(x);
        if(x<2) return false;
        for (int i = 2; i <=sqr; i++) {
            if(x%i==0){
                flag=false;
                break;
            }
        }
        return flag;
    }
    static long factorial( long x) {
        long total = 1;
        for (int i = 2; i <= x; i++)
            total *= i;
        return total;
    }
    static long power(long x, long n) {
        if (n == 0) {
            return 1;
        }

        long pow = power(x, n / 2L);
        if ((n & 1) == 1) {
            return x * pow * pow;
        }

        return pow * pow;
    }

    public static void main(String [] args) {
        startTime = System.currentTimeMillis();
         // int T = sc.nextInt();while (T--!=0)
        {
            solve();
        }
        endTime = System.currentTimeMillis();
        long duration= endTime-startTime;
        //System.out.println(duration);
    }

    // static Scanner sc = new Scanner(System.in);

    static FastReader sc = new FastReader();
    public static void solve()  {
//////////////////////////////////////////////////////////////////////
        String s = sc.next(),t=sc.next();
        int ss=s.length(),tt=t.length();
        int match;
        int max_match=0;
        for (int i = 0; i <=ss-tt; i++) {
            match=0;
            int k=i;
            for (int j = 0; j < tt; j++) {
                if(s.charAt(k)==t.charAt(j)){
                    match++;
                }
                k++;
            }
            max_match=Math.max(max_match,match);
        }
        System.out.println(tt-max_match);
///////////////////////////////////////////////////////////////////////
    }

}
