#include <iostream>
#include <vector>
#include <string>
#include<math.h>
#include<bits/stdc++.h>
#include <map>
#include <algorithm>
#include <cmath>


typedef long long ll;

using namespace std;
//const int MAX_CHAR = 26;


string sortString(string &str)
{
    //string a;
    sort(str.begin(), str.end());
    return  str;
}

string operator*(const string& s, unsigned int n)
{
    stringstream out;
    while (n--)
        out << s;
    return out.str();
}

int knapSack(int value[],int weight[],int w,int n)
{
    if( w==0 || n == 0)
    {
        return 0;
    }
    if(weight[n-1]<=w)
    {
        return max(value[n-1] + knapSack(value,weight,w-weight[n-1],n-1),knapSack(value,weight,w,n-1));
    }
    else if(weight[n-1]>w)return knapSack(value,weight,w,n-1);
}

int ribbon(int n,int a,int b,int c)
{
    int d = min(min(a,b),c);
    if(n==d)return 0;
}

void SieveOfEratosthenes(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for(int i= 2 ; i<n+1; i++)
    {
        if(prime[i]==true)
        {
            cout<<i<<endl;
        }
    }

}

bool length_con(int n,int m,int k)
{
    int d = 0;
    int sum = 0;
    while(n>0)
    {
        int c = n%10;
        sum += c;
        d++;
        n = n/10;
    }
    if(sum == m && d == k)
    {
        return true;
    }
    else
    {
        return false;
    }
}

int min_arr(int arr[],int n)
{
    int minim = 31;
    for(int i=0; i<n; i++)
    {
        if(arr[i]<minim)
        {
            minim = i;
        }
    }
    return minim;
}

int max_arr(int arr[],int n)
{
    int maxi = 0;
    for(int i=0; i<n; i++)
    {
        if(arr[i]>maxi)
        {
            maxi = i;
        }
    }
    return maxi;
}
int sum(int arr[],int n)
{
    int sum = 0;
    for(int i=0; i<n; i++)
    {
        sum+=arr[i];
    }
    return sum;
}

void sortEst()
{
    /* Filler code for Sortestimate topcoder from int main */
    int c,t;
    cin>>c>>t;

    double lo = 1;
    double hi = 2000000000 ;

    while(hi-lo>0)
    {
        double mid = (lo+hi)/2;
        double time = c * mid * log2(mid);
        //cout<<time<<"ddddv"<<mid<<endl;
        if(t==time)
        {
            cout<<mid<<endl;
            break;
        }
        else if( t>time )
        {
            lo = mid;
        }
        else if(t<time)
        {
            hi = mid;
        }
    }

}
int ans[1000];

int tiles(int n)
{
    ans[1] = 1;
    ans[2] = 2;

    for(int i=3; i<=n; i++)
    {
        ans[i] = ans[i-1] + ans[i-2];
    }
    return ans[n];
}
int supw(int n,int arr[],int m)
{
    if(m==n-1)return arr[m];
    if(m==n-2)return arr[m];
    if(m==n-3)return arr[m];

    return min( arr[m]+supw(n,arr,m+1),min(arr[m]+supw(n,arr,m+2),arr[m]+supw(n,arr,m+3)) );
}



// A Dynamic Programming solution
// for subset sum problem
#include <stdio.h>

// Returns true if there is a subset of set[]
// with sun equal to given sum
bool isSubsetSum(int set[], int n, int sum)
{
    // The value of subset[i][j] will be true if
    // there is a subset of set[0..j-1] with sum
    // equal to i
    bool subset[n + 1][sum + 1];

    // If sum is 0, then answer is true
    for (int i = 0; i <= n; i++)
        subset[i][0] = true;

    // If sum is not 0 and set is empty,
    // then answer is false
    for (int i = 1; i <= sum; i++)
        subset[0][i] = false;

    // Fill the subset table in botton up manner
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= sum; j++)
        {
            if (j < set[i - 1])
                subset[i][j] = subset[i - 1][j];
            if (j >= set[i - 1])
                subset[i][j] = subset[i - 1][j]
                               || subset[i - 1][j - set[i - 1]];
        }
    }

    /*   // uncomment this code to print table
     for (int i = 0; i <= n; i++)
     {
       for (int j = 0; j <= sum; j++)
          printf ("%4d", subset[i][j]);
       printf("\n");
     }*/

    return subset[n][sum];
}
bool equal_sum_partition(int arr[],int n,int sum)
{

    if(n==0 and sum !=0)return false;
    if(sum==0)return true;

    if(arr[n-1]>sum)return equal_sum_partition(arr,n-1,sum);

    return equal_sum_partition(arr,n-1,sum) || equal_sum_partition(arr,n-1,sum-arr[n-1]);
}

int subset_count(int arr[],int n,int sum)
{
    int subset[n + 1][sum + 1];
    memset(subset,0,sizeof(subset));

    for (int i = 0; i <= n; i++)
        subset[i][0] = 1;

    for (int i = 1; i <= sum; i++)
        subset[0][i] = 0;

    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=sum; j++)
        {
            if( j < arr[i-1] ) subset[i][j] = subset[i-1][j];
            else
            {
                subset[i][j] = subset[i-1][j] + subset[i-1][j-arr[i-1]];
            }
        }
    }
    return subset[n][sum];
}

int find_min(int arr[],int n)
{
    int diff = 100;
    int range = accumulate(arr,arr+n,0);
    for(int i=0; i<=range/2; i++)
    {
        if(isSubsetSum(arr,n,i))
        {
            diff = min(diff, range-2*i );
        }
    }
    return diff;
}

int unbounded_knapsack(int w,int value[],int weight[],int m)
{
    /* Not Correct */    if(m==0 || w==0)return 0;
    if( weight[m-1]>w )return unbounded_knapsack(w,value,weight,m-1);
    else return max( value[m-1] + unbounded_knapsack(w-value[m-1],value,weight,m),unbounded_knapsack(w,value,weight,m-1) );
}

int rod_cutting(int arr[],int n)
{
    int dp[n+1][n+1];
    for(int i=0; i<n+1; i++)
    {
        for(int j=0; j<n+1; j++)
        {
            if(i==0 || j==0)dp[i][j] = 0;
            else if(i>j)dp[i][j] = dp[i-1][j];
            else dp[i][j] = max(dp[i-1][j],arr[i-1]+dp[i][j-i]);
        }
    }
    return dp[n][n];
}
int coin_change_no_of_ways(int arr[],int n,int sum)
{
    if(sum==0)return 1;
    if( n <= 0 && sum > 0 )return 0;
    if( arr[n-1]>sum )return coin_change_no_of_ways(arr,n-1,sum);
    return coin_change_no_of_ways(arr,n-1,sum) + coin_change_no_of_ways(arr,n,sum-arr[n-1]);
}

int maxSum(int arr[], int n, int k)
{
    int res = 0;
    for (int i=0; i<k; i++)
        res += arr[i];
    int idx = 0;
    int curr_sum = res;
    for (int i=k; i<n; i++)
    {
        curr_sum += arr[i] - arr[i-k];

        if(curr_sum<res)
        {
            idx = i;
        }
        res = min(res, curr_sum);
    }

    if(idx==0) return 2;
    return idx;
}
int fact(int n)
{
    if(n==0 || n==1)return 1;
    return n*fact(n-1);
}
int pair_cal(int n)
{
    if(n==1)return 0;
    return (n-1)+pair_cal(n-1);
}

int most_repeating(int arr[],int n)
{
    unordered_map<int,int>v;
    for(int i=0; i<n; i++)
    {
        v[arr[i]] += 1;
    }
    int freq = -1;
    int res = 0;
    for(auto i:v)
    {
        if(i.second>freq)
        {
            freq = i.second;
            res = i.first;
        }
    }
    return res;
}

int get_smallest_divisor(int n)
{
    if(n%2==0)return 2;
    else
    {
        for(int i=3; i*i<=n; i+=2)
        {
            if(n%i==0)return i;
        }
    }
    return n;
}

void show_pq(priority_queue<int>pq)
{
    priority_queue<int>g = pq;
    while(!g.empty())
    {
        cout<<g.top()<<" ";
        g.pop();
    }
    cout<<endl;
}



void pairsort(int a[], int b[], int n)
{
    pair<int, int> pairt[n];
    for (int i = 0; i < n; i++)
    {
        pairt[i].first = a[i];
        pairt[i].second = b[i];
    }
    sort(pairt, pairt + n);
    for (int i = 0; i < n; i++)
    {
        a[i] = pairt[i].first;
        b[i] = pairt[i].second;
    }
}
void bin(unsigned n)
{
    unsigned i;
    for (i = 1 << 31; i > 0; i = i / 2)
        (n & i)? printf("1"): printf("0");
}

vector<pair<int ,int>>find_sub_sum_0(int arr[],int n){
    unordered_map<int,vector<int>>mp;
    vector<pair<int,int>>out;

    int sum = 0;
    for(int i=0;i<n;i++){
        sum += arr[i];
        if(sum==0){
            out.push_back(make_pair(0,i));
        }
        if(mp.find(sum) != mp.end()){
            vector<int>vc = mp[sum];
            for(auto it=vc.begin();it!=vc.end();it++){
               // out.push_back(*it+1,i);
            }
        }
        //map[sum].push_back(i);
    }
    return out;
}
int cnt[1000001];
int solve(int arr[],int n,int k,int z){
    int dp[n+1];
    dp[0] = 0,dp[1] = arr[0];
    for(int i=2;i<n+1;i++){
        if(k==0){
            dp[i] = dp[i-1];
            continue;
        }
        if(z==0){
            if(k>0){
                dp[i] = dp[i-1] + arr[i-1];
                k--;
            }
            else{
                dp[i] = dp[i-1];
            }
        }else{
            dp[i] = max(dp[i-1]+arr[i-2],dp[i-1]+arr[i-1]);
            if(dp[i]==dp[i-1]+arr[i-2]){
                z--;
            }
            k--;
        }
    }
    for(int i=0;i<n+1;i++){
        cout<<dp[i]<<" ";
    }
    cout<<endl;
    return dp[n];
}
bool cmp(pair<string, int>& a,
         pair<string, int>& b)
{
    return a.second < b.second;
}
bool is_prime(int n) {
    // Assumes that n is a positive natural number
    // We know 1 is not a prime number
    if (n == 1) {
        return false;
    }

    int i = 2;
    // This will loop from 2 to int(sqrt(x))
    while (i*i <= n) {
        // Check if i divides x without leaving a remainder
        if (n % i == 0) {
            // This means that n has a factor in between 2 and sqrt(n)
            // So it is not a prime number
            return false;
        }
        i += 1;
    }
    // If we did not find any factor in the above loop,
    // then n is a prime number
    return true;
}

int solve(ll arr[],ll n,ll sum){
    vector<ll>a;
    if(sum%n){
            sum -= n;
            ll cnter = 1;
            a.push_back(n);
            arr[n-1] = -1;
            for(ll i=1;sum>0;i++){
                sum -= i;
                a.push_back(i);
                arr[i-1] = -1;
                if(sum==0)break;
                sum -= n-i;
                a.push_back(n-i);
                arr[n-i-1] = -1;
            }
        cout<<a.size()<<endl;
        for(auto i:a)cout<<i<<" ";
        cout<<endl;
        cout<<n-a.size()<<endl;
        for(ll i=0;i<n;i++){
            if(arr[i]!=-1)cout<<arr[i]<<" ";
        }
        cout<<endl;
        }
    else{
        sum -= n;
        ll cnter = 1;
        a.push_back(n);
        arr[n-1] = -1;
        for(ll i=1;sum!=0;i++){
            sum-=i;
            a.push_back(i);
            arr[i-1] = -1;
            if(sum==0)break;

            sum-=n-i;
            a.push_back(n-i);
            arr[n-i-1] = -1;
        }
        cout<<a.size()<<endl;
        for(auto i:a)cout<<i<<" ";
        cout<<endl;
        cout<<n-a.size()<<endl;
        for(ll i=0;i<n;i++){
            if(arr[i]!=-1)cout<<arr[i]<<" ";
        }
        cout<<endl;
    }
}
set<string>str;
void permute(string s,int l,int r){
    if(l==r){
        //cout<<s<<endl;
        str.insert(s);
    }
    else{
        for(int i=l;i<=r;i++){
            swap(s[i],s[l]);
            permute(s,l+1,r);
            swap(s[i],s[l]);
        }
    }
}
int main(){
    string s,t;
    cin>>s>>t;
    int max_change = t.size();
    int n = s.size();

    int max_matched = 0;
    for(int i=0;i<n-max_change+1;i++){
        int a = 0;
        for(int j=0;j<max_change;j++){
            if(s[i+j]==t[j])a++;
        }
        max_matched = max(max_matched,a);
    }
    cout<<max_change-max_matched<<endl;
}





Measured memory_bytes: 3660