#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define ll long long
#define ld long double
ll const N=1e5+9;
ll const INF=8223372036854775807;
ll const INFF=2147483647;
 
#define pb push_back
#define popb pop_back()
#define pf push_front
#define popf pop_front()
#define si size()
#define be begin()
#define en end()
#define all(v) v.be, v.en
#define len length()
#define mp make_pair
#define mt make_tuple
#define umap unordered_map
#define uset unordered_set
#define acc(v) accumulate(all(v), 0)
#define F first
#define S second

typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> plll;


 
#define forz(i, n) for (ll i = 0; i < n; i++)
#define fore(i, m, n) for (ll i = m; i <= n; i++)
#define rforz(i, n) for (ll i = n - 1; i >= 0; i--)
#define rfore(i, m, n) for (ll i = m; i >= n; i--)
#define deci(n) fixed << setprecision(n)
#define high(n) __builtin_popcount(n)
#define highll(n) __builtin_popcountll(n)
#define parity(n) __builtin_parity(n)
#define ctz(n) __builtin_ctz(n)
#define lb lower_bound
#define ub upper_bound
#define er equal_range
#define maxe *max_element
#define mine *min_element
#define mod 1000000007
#define mod2 998244353
#define PI 3.1415926535

#define gcd __gcd
#define prag ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
 
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl







// GRAPHS
/*
vector<ll> adj[N];
vector<ll> till;
ll value[N],parent[N];
bool visited[N];
bool rec[N];
ll ans[N];
bool isCycle=false;
// ll clr[N];


 
ll dfs(ll s,ll p, ll n){
    
   
//    for(int i=0;i<n;i++)
//    {
//        if(visited[i-1] && __gcd(value[i-1],value[s-1])==1) ans[i-1]++;  // 0 indexed
//    }

   cout<<s<<": ";
   int k=till.size();
   for(int i=0;i<k;i++)
   { 
      cout<<till[i]<<" ";
      if(__gcd(value[s-1],value[till[i]-1])==1) ans[till[i]-1]++;
   }

   cout<<endl;


    visited[s-1]=true;

    till.push_back(s);
    for(auto x:adj[s])
    {
        if(x==p || x==s){
            continue;
        }
            
        dfs(x,s,n);
           
        
    }
    till.pop_back();
    visited[s-1]=false;
    
    

}

void dfs2(ll s,ll p){
    sizz[s]=1;
    visited[s]=true;
    rec[s]=true;
   
    for(auto x:adj[s]){
       
            if(visited[x]==false)
            {
        
            depth[x]=depth[s]+1;
            dfs(x,s);
            sizz[s]=sizz[s]+sizz[x];

            }
            else if(rec[x]) isCycle=true;
           
        
    }
    rec[s]=false;
}
*/



bool checkPrime(ll x)
{
    if (x == 1)
    {
        return false;
    }
    if (x <= 3)
    {
        return true;
    }
    ll t = 2;
    if (x % 2 == 0)
    {
        return false;
    }
    t = 3;
    for (t; t <= sqrt(x); t += 2)
    {
        if (x % t == 0)
        {
            return false;
        }
    }
    return true;
}



/// used for internal sorting in minpriority queue
template <class pll> struct greatter : binary_function <pll,pll,bool> {
  bool operator() (const pll& p1, const pll& p2) const 
  {
    if(p2.S-p2.F>p1.S-p1.F) return true;
    else if(p2.S-p2.F==p1.S-p1.F)
    { 
        if(p1.F>p2.F)  return true;
        else return false;
    }
    else return false;
  }
};

ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      
    x = x % p;  
  
    while (y > 0) 
    { 
       
        if (y & 1) 
            res = (res*x) % p; 
  
        
        y = y>>1; 
        x = (x*x) % p; 
    } 
    return res; 
}

ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 

ll nCrModPFermat(ll n, ll r, ll p) 
{ 
   
   if (r==0) 
      return 1; 
  
    
    ll fac[n+1]; 
    fac[0] = 1; 
    for (ll i=1 ; i<=n; i++) 
        fac[i] = fac[i-1]*i%p; 
  
    return (fac[n] % p * modInverse(fac[r], p) % p* modInverse(fac[n-r], p) % p) % p; 
}




// ll dp[3605][8005];
// ll countsubsets(vector<ll> arr,ll ss, ll i,ll remsum)
// {
//    if(i==ss) 
//    {
//        if(remsum==0) return 1;
//        else return 0;
//    }

//    if(dp[i][remsum]!=-1) return dp[i][remsum];
//    else
//    {
//        dp[i][remsum]=countsubsets(arr,ss,i+1,remsum)+countsubsets(arr,ss,i+1,remsum-arr[i]);
//        return  dp[i][remsum];
//    }
   

// }

bool comp1(string ss1,string ss2)
{
    if(ss1+ss2 <= ss2+ss1) return true;
    else return false;
}

vector<int> findmaxright_index(vector<int>&arr, int n)
{
    stack<pair<int,int>> st;
    vector<int> ans(n,0);
    for(int i=0;i<n;i++)
    {
        if(st.empty()) st.push(make_pair(arr[i],i));
        else
        {
            while(!st.empty() && st.top().first<arr[i])
            {
              ans[st.top().second]=i;
              st.pop();

            }
            st.push(make_pair(arr[i],i));
        }
        
    }

    while(!st.empty())
    {
              ans[st.top().second]=n;
              st.pop();   
    }
    return ans;
}

vector<int> findmaxleft_index(vector<int>&arr, int n)
{
    stack<pair<int,int>> st;
    vector<int> ans(n,0);
    for(int i=n-1;i>=0;i--)
    {
        if(st.empty()) st.push(make_pair(arr[i],i));
        else
        {
            while(!st.empty() && st.top().first<arr[i])
            {
              ans[st.top().second]=i;
              st.pop();

            }
            st.push(make_pair(arr[i],i));
        }
        
    }

    while(!st.empty())
    {
              ans[st.top().second]=-1;
              st.pop();   
    }

    return ans;
}



/*
void permute(vector<ll> vec, int l, int r)  
{  
    // Base case  
    if (l == r)  
        {
            int sans=0;
            for(int i=0;i<vec.si;i++)
            sans=sans*10+vec[i];
            
            fans+=sans;


        }  
    else
    {  
        // Permutations made  
        for (int i = l; i <= r; i++)  
        {  
  
            // Swapping done  
            swap(vec[l], vec[i]);  
  
            // Recursion called  
            permute(vec, l+1, r);  
  
            //backtrack  
            swap(vec[l], vec[i]);   
        }  
    }  
}
0*/ 

/*

void mkstring(string s,ll lth,ll idx)
{

    
        ll a=0;
        for(ll i=0;i<=lth-6;i++)
        {
                 if(s.substr(i,7)=="abacaba") a++;

        }

        if(a==1) {found=true; ans=s; return;}

        
       if(idx==lth) return;
   
    
    if(s[idx]=='?') 
    {
        for(char p='a';p<='c';p++)
        {
            s[idx]=p;
            mkstring(s,lth,idx+1);


            if(found) return;

        }
    }
    else
    {
         mkstring(s,lth,idx+1);
    }
    

     return;
 

}
*/
int binarys(vector<int> &A,int sii,int li,int val,int idx)
{
    if(sii>li) return idx;
    int mid=(sii+li)/2;
    
   
    if(A[mid]<=val)
    {  
       
        if(A[mid]==val) idx=mid;
        return binarys(A,mid+1,li,val,idx);
    }
    else if(A[mid]>val)
    {
     
        
        return binarys(A,sii,mid-1,val,idx);
    }
}

int findOverlappingPair(string str1, string str2, string &str) 
{ 
    // max will store maximum overlap i.e maximum 
    // length of the matching prefix and suffix 
    int max = INT_MIN; 
    int len1 = str1.length(); 
    int len2 = str2.length(); 
  
    // check suffix of str1 matches with prefix of str2 
    for (int i = 1; i <= min(len1, len2); i++) 
    { 
        // compare last i characters in str1 with first i 
        // characters in str2 
        if (str1.compare(len1-i, i, str2, 0, i) == 0) 
        { 
            if (max < i) 
            { 
                //update max and str 
                max = i; 
                str = str1 + str2.substr(i); 
            } 
        } 
    } 
  
    // check prefix of str1 matches with suffix of str2 
    for (int i = 1; i <= min(len1, len2); i++) 
    { 
        // compare first i characters in str1 with last i 
        // characters in str2 
        if (str1.compare(0, i, str2, len2-i, i) == 0) 
        { 
            if (max < i) 
            { 
                //update max and str 
                max = i; 
                str = str2 + str1.substr(i); 
            } 
        } 
    } 


    if(len1<len2)
    {
        for (int i = 0; i <= len2-len1; i++) 
        if(str2.substr(i,len1)==str1)
        {
            if (max < len2) 
            { 
                //update max and str 
                max = len2; 
                str = str2; 
            } 
        }
    }
    else
    {
        for (int i = 0; i <= len1-len2; i++) 
        if(str1.substr(i,len2)==str2)
        {
            if (max < len1) 
            { 
                //update max and str 
                max = len1; 
                str = str1; 
            } 
        }
    }
    
  
    return max; 
} 

ll findpairs(vector<ll> &vec, ll s)
{
    int ptr1=0,ptr2=vec.si-1;
    int ans=0;
    while(ptr1<ptr2)
    {
        if(vec[ptr1]+vec[ptr2]==s) {ans++; ptr1++; ptr2--;}
        else if(vec[ptr1]+vec[ptr2]<s) ptr1++;
        else ptr2--;
    }

    return ans;
}


int func(string a,string b)
{
    int i=0,cnt=0;
    int n=b.size();
    for(int i=0;i<n;i++) if(a[i]!=b[i]) cnt++;

    return cnt;
}


int main()
{
        prag;
        ll T=1;
        //cin>>T;
        while(T--)
        {
            
          string s,t;
          cin>>s;
          cin>>t;

         
         
          int n=s.size(),k=t.size();
          int cnt=INT_MAX;
          for(int i=0;i<=n-k;i++)
          {
            cnt=min(cnt,func(s.substr(i,k),t));


          }

          cout<<cnt<<endl;


        }

           
return 0;

}

Measured memory_bytes: 3632