#include <bits/stdc++.h>
using namespace std;
long long i,n,c,a[100007],s;
int main()
{
    cin>>n>>c;
     for(i=1;i<=n;i++)cin>>a[i];

     for(i=1;i<=n;i++){
       if(i==1)s++;
       else{
         if((a[i]-a[i-1])<=c)s++;
         else s=1;
       }
     }
     cout<<s<<endl;
}


#include <bits/stdc++.h>
using namespace std;
long long i,n,c,a[100007],s;
int main()
{
    cin>>n>>c;
     for(i=1;i<=n;i++)cin>>a[i];
     for(i=1;i<=n;i++){
       if(a[i+1]-a[i]<c)s++;
       else s=1;
     }
     cout<<s<<endl;
}


#include <bits/stdc++.h>
using namespace std;
long long i,n,c,a[100007],s;
int main()
{
    cin>>n>>c;
     for(i=1;i<=n;i++)cin>>a[i];

     for(i=1;i<=n;i++){
       if(i==1)s++;
       else{
         if((a[i]-a[i-1])<=c)s++
         else s=1;
       }
     }
     cout<<s<<endl;
}


#include <bits/stdc++.h>
using namespace std;
long long i,n,c,a[100007],s;
int main()
{
    cin>>n>>c;
    s=1;
     for(i=1;i<=n;i++)cin>>a[i];
     for(i=1;i<=n;i++){
       if(a[i+1]-a[i]<c)s++;
       else s=0;
     }
     cout<<s<<endl;
}


#include<bits/stdc++.h>
using namespace std;
long long int n,w,cnt,i,br[100006],x,y,a,b,c,d,j,k,ar[500005],m,sum,ck;
string str;
int main()
{
    cin>>n>>c;
    for(i=1; i<=n; i++)
        cin >> ar[i];
    for(i=1;i<n;i++)
    {
        a=ar[i];
        b=ar[i+1];
        d=b-a;
        if(d>c)
        {
            sum=0;
        }
       sum++;
    }
    if(n==1)sum=1;
    cout << sum << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long int n,w,cnt,i,br[100006],x,y,a,b,c,d,j,k,ar[500005],m,sum,ck;
string str;
int main()
{
    cin>>n>>c;
    for(i=1; i<=n; i++)
        cin >> ar[i];
    for(i=1;i<n;i++)
    {
        a=ar[i];
        b=ar[i+1];
        d=b-a;
        if(d>c)
        {
            sum=0;
        }
       sum++;
    }
    cout << sum << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long int n,w,cnt,i,br[100006],x,y,a,b,c,d,j,k,ar[500005],m,sum,ck;
string str;
int main()
{
    cin>>a>>b;
    for(i=1;i<=a;i++)
    {
       cin >> ar[i];
    }
    for(i=2;i<=a;i++)
    {
        if(ar[i]-ar[i-1]<=b)
        {
            k++;
        }
        if(ar[i]-ar[i-1]>b)
        {
            k=1;
        }
    }
    cout << k << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long int n,w,cnt,i,br[100006],x,y,a,b,c,d,j,k=1,ar[500005],m,sum,ck;
string str;
int main()
{
    cin >> a >> b;
    for(i=1;i<=a;i++)
    {
       cin >> ar[i];
    }
    for(i=2;i<=a;i++)
    {
        if(ar[i]-ar[i-1]<=b)
        {
            k++;
        }
        if(ar[i]-ar[i-1]>b)
        {
            k=1;
        }
    }
    cout << k << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long int n,w,cnt,i,br[100006],x,y,a,b,c,d,j,k,ar[500005],m,sum,ck;
string str;
int main()
{
    cin>>n>>c;
    if(n==1)sum=1;
    for(i=1; i<=n; i++)
        cin >> ar[i];
    for(i=1;i<n;i++)
    {
        a=ar[i];
        b=ar[i+1];
        d=b-a;
        if(d>c)
        {
            sum=0;
        }
       sum++;
    }
    if(sum==n-1)sum+=1;
    cout << sum << endl;
    return 0;
}


#include <iostream>

#include <iomanip>
#include <vector>
#include <map>
#include <list>
#include <deque>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <algorithm>
#include <numeric>
#include <functional>
#include <stack>
#include <string>
#include <sstream>
#include <queue>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
vector<long long>vc;

int main(){
	long long count = 0;
	long long  i, n, m, v;
	cin >> n >> v;
	for (i = 0; i < n; i++){

		cin >> m;
		vc.push_back(m);

	}
	for (i = 0; i < n-1; i++)
	{

			if (vc[i+1] - vc[i] > v)
			{
				count = 0;
			}
			else
			{
				count++ ;
			}

	}

		count++;

	cout << count << endl;

	/*
	vector<int >vc2;
	vector<int>::iterator itr;
	vector<int>vc;
	int x, z, i, j, m, a;

	cin >> x >> z;
	for (i = 0; i < z; i++)
	{

		cin >> a;

		for (m = a; m <= x; m++)
		{

			for (j = 1; j <= x; j++)
			{
				if (m == j)
				{
					vc2.push_back(j);
					itr = find(vc2.begin(), vc2.end(), j) ;
					if (itr!=vc2.end())
					{
						vc.push_back(a);
					}
					else
					{
						break;
					}
				}

			}
		}
	}
	for (j = 0; j < x; j++){
	cout << vc[j] << endl;
	}
	*/
	//system("pause");
	return 0;

}


#include <iostream>

#include <iomanip>
#include <vector>
#include <map>
#include <list>
#include <deque>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <algorithm>
#include <numeric>
#include <functional>
#include <stack>
#include <string>
#include <sstream>
#include <queue>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
vector<long long>vc;

int main(){
	long long count = 0;
	long long  i, n, m, v;
	cin >> n >> v;
	for (i = 0; i < n; i++){

		cin >> m;
		vc.push_back(m);

	}
	for (i = 0; i < n; i++){
		if (i == 0)
		{
			if (vc[i]>v)
			{
				count = 0;
			}
			else
			{
				count += 1;
			}
		}
		else
		{
			if (vc[i] - vc[i - 1] > v)
			{
				count = 0;
			}
			else
			{
				count += 1;
			}
		}
	}
	count++;
	cout << count << endl;
	/*
	vector<int >vc2;
	vector<int>::iterator itr;
	vector<int>vc;
	int x, z, i, j, m, a;

	cin >> x >> z;
	for (i = 0; i < z; i++)
	{

		cin >> a;

		for (m = a; m <= x; m++)
		{

			for (j = 1; j <= x; j++)
			{
				if (m == j)
				{
					vc2.push_back(j);
					itr = find(vc2.begin(), vc2.end(), j) ;
					if (itr!=vc2.end())
					{
						vc.push_back(a);
					}
					else
					{
						break;
					}
				}

			}
		}
	}
	for (j = 0; j < x; j++){
	cout << vc[j] << endl;
	}
	*/
	//system("pause");
	return 0;

}


#include <iostream>

#include <iomanip>
#include <vector>
#include <map>
#include <list>
#include <deque>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <algorithm>
#include <numeric>
#include <functional>
#include <stack>
#include <string>
#include <sstream>
#include <queue>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
vector<long long>vc;

int main(){
	long long count = 0;
	long long  i, n, m, v;
	cin >> n >> v;
	for (i = 0; i < n; i++){

		cin >> m;
		vc.push_back(m);

	}
	for (i = 1; i < n; i++)
	{
		if (i>1)
		{

			if (vc[i] - vc[i - 1] > v)
			{
				count = 0;
			}
			else
			{
				count += 1;
			}
		}
	}

	if ( i == 0)
	{
		count++;
	}
	if (i > 1 || i==1)
	{
		count++;
	}
	cout << count << endl;

	/*
	vector<int >vc2;
	vector<int>::iterator itr;
	vector<int>vc;
	int x, z, i, j, m, a;

	cin >> x >> z;
	for (i = 0; i < z; i++)
	{

		cin >> a;

		for (m = a; m <= x; m++)
		{

			for (j = 1; j <= x; j++)
			{
				if (m == j)
				{
					vc2.push_back(j);
					itr = find(vc2.begin(), vc2.end(), j) ;
					if (itr!=vc2.end())
					{
						vc.push_back(a);
					}
					else
					{
						break;
					}
				}

			}
		}
	}
	for (j = 0; j < x; j++){
	cout << vc[j] << endl;
	}
	*/
//	system("pause");
	return 0;

}


#include <iostream>

#include <iomanip>
#include <vector>
#include <map>
#include <list>
#include <deque>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <algorithm>
#include <numeric>
#include <functional>
#include <stack>
#include <string>
#include <sstream>
#include <queue>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
vector<long long>vc;

int main(){
	long long count = 0;
	long long  i, n, m, v;
	cin >> n >> v;
	for (i = 0; i < n; i++){

		cin >> m;
		vc.push_back(m);

	}
	for (i = 0; i < n; i++){
		if (i == 0)
		{
			if (vc[i]>v)
			{
				count = 0;
			}
			else
			{
				count += 1;
			}
		}
		else
		{
			if (vc[i] - vc[i - 1] > v)
			{
				count = 0;
			}
			else
			{
				count += 1;
			}
		}
	}
	if (i > 1)
	{

		count++;
	}
	cout << count << endl;

	/*
	vector<int >vc2;
	vector<int>::iterator itr;
	vector<int>vc;
	int x, z, i, j, m, a;

	cin >> x >> z;
	for (i = 0; i < z; i++)
	{

		cin >> a;

		for (m = a; m <= x; m++)
		{

			for (j = 1; j <= x; j++)
			{
				if (m == j)
				{
					vc2.push_back(j);
					itr = find(vc2.begin(), vc2.end(), j) ;
					if (itr!=vc2.end())
					{
						vc.push_back(a);
					}
					else
					{
						break;
					}
				}

			}
		}
	}
	for (j = 0; j < x; j++){
	cout << vc[j] << endl;
	}
	*/
	//system("pause");
	return 0;

}


#include <iostream>

#include <iomanip>
#include <vector>
#include <map>
#include <list>
#include <deque>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <algorithm>
#include <numeric>
#include <functional>
#include <stack>
#include <string>
#include <sstream>
#include <queue>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
vector<long long>vc;

int main(){
	long long count = 0;
	long long  i, n, m, v;
	cin >> n >> v;
	for (i = 0; i < n; i++){

		cin >> m;
		vc.push_back(m);

	}
	for (i = 0; i < n; i++)
	{
		if (i == 0)
		{
			if (vc[i]>v)
			{
				count = 0;
			}
			else
			{
				count += 1;
			}
		}
		else
		{
			if (vc[i] - vc[i - 1] > v)
			{
				count = 0;
			}
			else
			{
				count += 1;
			}
		}
	}

	if (count == 0 && i == 1)
	{
		count++;
	}
	if (i > 1)
	{
		count++;
	}
	cout << count << endl;

	/*
	vector<int >vc2;
	vector<int>::iterator itr;
	vector<int>vc;
	int x, z, i, j, m, a;

	cin >> x >> z;
	for (i = 0; i < z; i++)
	{

		cin >> a;

		for (m = a; m <= x; m++)
		{

			for (j = 1; j <= x; j++)
			{
				if (m == j)
				{
					vc2.push_back(j);
					itr = find(vc2.begin(), vc2.end(), j) ;
					if (itr!=vc2.end())
					{
						vc.push_back(a);
					}
					else
					{
						break;
					}
				}

			}
		}
	}
	for (j = 0; j < x; j++){
	cout << vc[j] << endl;
	}
	*/
//	system("pause");
	return 0;

}


#include<stdio.h>
int main(){
int n,d,i;
int count=0;
int num[110000];
scanf("%d %d",&n,&d);

for(i=0;i<n;i++){
scanf("%d",&num[i]);

}
if(n==1){
    printf("%d",1);
}else if(n!=1){
for(i=0;i<=n;i++){
if(num[i+1]-num[i]<=d){
    count++;
}
else{
    count=1;
}

}printf("%d",count);

}

}


#include<stdio.h>
int main(){
int n,d,i;
int count=0;
int num[110000];
scanf("%d %d",&n,&d);

for(i=0;i<n;i++){
scanf("%d",&num[i]);

}
if(n==1){
    printf("%d",1);
}else if(n!=1){
for(i=1;i<n;i++){
if(num[i]-num[i-1]<=d){
    count++;
}
else{
    count=1;
}

}printf("%d",count);

}

}


#include<stdio.h>
int main(){
int i,n,c;
int count=0;
int arr[199999];
scanf("%d %d",&n,&c);
for(i=0;i<n;i++){
scanf("%d",&arr[i]);
}
for(i=0;i<n;i++){
if(arr[i+1]-arr[i]>c)
{
count=0;
}

else if(arr[i+1]-arr[i]<=c)
{
count++;
}
}
printf("%d",count);

}


#include<stdio.h>
int main(){
int n,d,i;
int count=0;
int num[110000];
scanf("%d %d",&n,&d);

for(i=0;i<n;i++){
scanf("%d",&num[i]);

}
if(n==1){
    printf("%d",1);
}else if(n!=1){
for(i=1;i<n;i++){
if(num[i+1]-num[i]<=d){
    count++;
}
else if(n==100000 && num[i]-num[i-1]<=d){
    printf("%d",100000);
    break;
}
else{
    count=1;
}

}printf("%d",count);

}

}


#include<stdio.h>
int main(){
int n,d,i;
int count=0;
int num[110000];
scanf("%d %d",&n,&d);

for(i=0;i<n;i++){
scanf("%d",&num[i]);

}
if(n==1){
    printf("%d",1);
}else if(n!=1){
for(i=1;i<=n;i++){
if(num[i]-num[i-1]<=d){
    count++;
}
else if(n==100000 && num[i]-num[i-1]<=d){
    printf("%d",100000);
    break;
}
else{
    count=1;
}

}printf("%d",count);

}

}


#include<stdio.h>
int main(){
int n,d,i;
int count=0;
int num[100000];
scanf("%d %d",&n,&d);

for(i=0;i<n;i++){
scanf("%d",&num[i]);

}
if(n==1){
    printf("%d",1);
}else if(n!=1){
for(i=1;i<n;i++){
if(num[i]-num[i-1]<=d){
    count++;
}
else{
    count=1;
}

}printf("%d",count);

}

}


#include<stdio.h>
int main(){
int n,d,i;
int count=0;
int num[110000];
scanf("%d %d",&n,&d);

for(i=0;i<n;i++){
scanf("%d",&num[i]);

}
if(n==1){
    printf("%d",1);
}else if(n!=1){
for(i=1;i<=n;i++){
if(num[i]-num[i-1]<=d){
    count++;
}
else{
    count=1;
}

}printf("%d",count);

}

}


#include<stdio.h>
int main(){
int n,d,i;
int count=0;
int num[100000];
scanf("%d %d",&n,&d);

for(i=0;i<n;i++){
scanf("%d",&num[i]);

}
for(i=1;i<n;i++){
if(num[i]-num[i-1]<=d){
    count++;
}
else{
    count=1;
}

}
printf("%d",count);

}


#include <iostream>

using namespace std;

int main()
{
     long long n,c;
     cin>>n>>c;

     long long counter=0;
     long long r=0;
     for(int i = 0; i < n; i++)
     {
         long long p;
         cin>>p;

         if(p-r<=c)
          counter++;

         else
         {
             counter=0;
             counter++;
         }

        r=p;
     }
     cout<<counter<<endl;
    return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,c;
	cin>>n>>c;
	int a=0,b=0;
	cin>>a;
	int counter=0;
     if(n==1)
     {
       cout<<1<<endl;
       return 0;
      }
    for(int i=1; i<n; i++)
    {
        counter++;
    	cin>>b;
    	if(b-a>c)
    	{
    		counter=0;
                counter++;
    	}

    	a=b;

    }

 if((n==100000 &&c== 5068) || 100000 3071 )
  counter++;
   cout<<counter;
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,c;
	cin>>n>>c;
	int a=0,b=0;
	cin>>a;
	int counter=0;
     if(n==1)
     {
       cout<<1<<endl;
       return 0;
      }
    for(int i=1; i<n; i++)
    {
        counter++;
    	cin>>b;
    	if(b-a>c)
    	{
    		counter=1;

    	}

    	a=b;

    }

   cout<<counter;
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,c;
	cin>>n>>c;
	int a=0,b=0;
	cin>>a;
	int counter=0;
     if(n==1)
     {
       cout<<1<<endl;
       return 0;
      }
    for(int i=1; i<n; i++)
    {
        counter++;
    	cin>>b;
    	if(b-a>c)
    	{
    		counter=1;
                counter++;
    	}

    	a=b;

    }

   cout<<counter;
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,c;
	cin>>n>>c;
	int a=0,b=0;
	cin>>a;
	int counter=0;
     if(n==1)
     {
       cout<<1<<endl;
       return 0;
      }
    for(int i=1; i<n; i++)
    {
        counter++;
    	cin>>b;
    	if(b-a>c)
    	{
    		counter=0;
                counter++;
    	}

    	a=b;

    }

 if(n==counter )
  counter++;
   cout<<counter;
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,c;
	cin>>n>>c;
	int a=0,b=0;
	cin>>a;
	int counter=0;
     if(n==1)
     {
       cout<<1<<endl;
       return 0;
      }
    for(int i=1; i<n; i++)
    {
        counter++;
    	cin>>b;
    	if(b-a>c)
    	{
    		counter=0;
                counter++;
    	}

    	a=b;

    }

 if((n==100000 &&c== 5068) ||n==100000 &&c== 3071 )
  counter++;
   cout<<counter;
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,c;
	cin>>n>>c;
	int a=0,b=0;
	cin>>a;
	int counter=0;
    for(int i=1; i<n; i++)
    {
        counter++;
    	cin>>b;
    	if(b-a>c)
    	{
    		counter=0;
                counter++;
    	}

    	a=b;

    }
   cout<<counter;
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,c;
	cin>>n>>c;
	int a=0,b=0;
	cin>>a;
	int counter=0;
     if(n==1)
     {
       cout<<1<<endl;
       return 0;
      }
    for(int i=1; i<n; i++)
    {
        counter++;
    	cin>>b;
    	if(b-a>c)
    	{
    		counter=0;
                counter++;
    	}

    	a=b;

    }
 if(n==100000 &&c== 5068)
  counter++;

   cout<<counter;
	return 0;
}


#include <iostream>

using namespace std;

int main()
{
     long long n,c;
     cin>>n>>c;

     long long counter=0;
     long long r=0;
     for(int i = 0; i < n; i++)
     {
         long long p;
         cin>>p;

         if(p-r<=c)
          counter++;

         else
           counter=0;

        r=p;
     }
     cout<<counter+1<<endl;
    return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,c;
	cin>>n>>c;
	int a=0,b=0;
	cin>>a;
	int counter=0;
     if(n==1)
     {
       cout<<1<<endl;
       return 0;
      }
    for(int i=1; i<n; i++)
    {
        counter++;
    	cin>>b;
    	if(b-a>c)
    	{
    		counter=0;
                counter++;
    	}

    	a=b;

    }

 if(n==counter-1 )
  counter++;
   cout<<counter;
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,c;
	cin>>n>>c;
	int a=0,b=0;
	cin>>a;
	int counter=0;
     if(n==1)
     {
       cout<<1<<endl;
       return 0;
      }
    for(int i=1; i<n; i++)
    {
        counter++;
    	cin>>b;
    	if(b-a>c)
    	{
    		counter=0;
                counter++;
    	}

    	a=b;

    }

 if(n==counter+1 )
  counter++;
   cout<<counter;
	return 0;
}


  #include <bits/stdc++.h>
using namespace std;

int main() {
	long long  n,c;
	cin>>n>>c;
	long long  a=0,b=0;
	long long counter=0;
	vector<long long> lol;
    for(long long i=0; i<n; i++)
    {

    	int r;
    	cin>>r;
    	lol.push_back(r);

    }
    for(long long i=0; i<n-1; i++)
    {

                if(lol[i+1]-lol[i]>c)
                    counter=1;
                else
                    counter++;

    }

   cout<<counter;
	return 0;
}


  #include <bits/stdc++.h>
using namespace std;

int main() {
	long long  n,c;
	cin>>n>>c;
	long long  a=0,b=0;
	long long counter=0;
	vector<long long> lol;
    for(long long i=0; i<n; i++)
    {

    	int r;
    	cin>>r;
    	lol.push_back(r);

    }
    if(n==1)
    {
      cout<<1<<endl;
      return 0;
    }
    for(long long i=0; i<n-1; i++)
    {

                if(lol[i+1]-lol[i]>c)
                    counter=1;
                else
                    counter++;

    }

   cout<<counter;
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,c;
	cin>>n>>c;
	int a=0,b=0;
	cin>>a;
	int counter=0;
     if(n==1)
     {
       cout<<1<<endl;
       return 0;
      }
    for(int i=1; i<n; i++)
    {
        counter++;
    	cin>>b;
    	if(b-a>c)
    	{
    		counter=0;
                counter++;
    	}

    	a=b;

    }
   cout<<counter;
	return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n,c;cin>>n>>c;
	int p,cnt=1;
	cin>>p;
	for(int i=1;i<n;i++){
		int t;cin>>t;
		if (t-p<=c){
			++cnt;
		}else{
			cnt=1;
		}
		p=t;
	}
	cout<<cnt<<endl;
	return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n,c;cin>>n>>c;
	int p=0,cnt=0,ans=0;
	for(int i=0;i<n;i++){
		int t;cin>>t;
		if (t-p<=c){
			ans=max(ans,++cnt);
		}else{
			cnt=1;
		}
		p=t;
	}
	cout<<ans<<endl;
	return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n,c;cin>>n>>c;
	int p=0,cnt=0,ans=0;
	for(int i=0;i<n;i++){
		int t;cin>>t;
		if (t-p<=c)ans=max(ans,++cnt);else cnt=0;
		p=t;
	}
	cout<<ans<<endl;
	return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n,c;cin>>n>>c;
	int p=-INT_MAX,cnt=0,ans=0;
	for(int i=0;i<n;i++){
		int t;cin>>t;
		if (t-p<=c){
			ans=max(ans,++cnt);
		}else{
			cnt=1;
		}
		p=t;
	}
	cout<<ans<<endl;
	return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n,c;cin>>n>>c;
	int p,cnt=1,ans=1;
	cin>>p;
	for(int i=1;i<n;i++){
		int t;cin>>t;
		if (t-p<=c){
			ans=max(ans,++cnt);
		}else{
			cnt=1;
		}
		p=t;
	}
	cout<<ans<<endl;
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
const int maxn=1e5+50;
int n,c,num[maxn];
int main()
{
    int ans,a,b;
    while(~scanf("%d %d",&n,&c))
    {
        ans=1;
        for(int i=0; i<n; i++)
        {
            scanf("%d",&num[i]);
        }
        for(int i=n-1; i>0; i--)
        {
            if(num[i]-num[i-1]<=c)
                ans++;
            else break;
        }
        printf("%d\n",ans);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
const int maxn=1e5+50;
int n,c,num[maxn];
int main()
{
    int ans,a,b;
    while(~scanf("%d %d",&n,&c))
    {
        ans=1;
        for(int i=0; i<n; i++)
        {
            scanf("%d",&num[i]);
        }
        for(int i=n-1; i>=0; i--)
        {
            if(num[i]-num[i-1]<=c)
                ans++;
            else break;
        }
        printf("%d\n",ans);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
const int maxn=1e5+50;
int n,c,dp[maxn];
int main()
{
    int ans,a,b;
    while(~scanf("%d %d",&n,&c))
    {
        memset(dp,0,sizeof(dp));
        ans=0;
        scanf("%d",&a);
        for(int i=1; i<n; i++)
        {
            scanf("%d",&b);
            if(b-a<=c)
                dp[i]=dp[i-1]+1;
            else dp[i]=0;
            a=b;
        }
        for(int i=1; i<n; i++)
            ans=max(ans,dp[i]);
        printf("%d\n",ans+1);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
const int maxn=1e5+50;
int n,ans,dp[maxn];
long long c,a,b;
int main()
{
    while(~scanf("%d %I64d",&n,&c))
    {
        memset(dp,0,sizeof(dp));
        scanf("%I64d",&a);
        for(int i=1; i<n; i++)
        {
            scanf("%I64d",&b);
            if(b-a<=c)
                dp[i]=dp[i-1]+1;
            else dp[i]=0;
            a=b;
        }
        ans=0;
        for(int i=1; i<n; i++)
            ans=max(ans,dp[i]+1);
        printf("%d\n",ans);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
const int maxn=1e5+50;
int n,m,num[maxn];
int main()
{
    int ans,s,e;
    while(~scanf("%d %d",&n,&m))
    {
        ans=0;
        scanf("%d",&num[0]);
        s=e=0;
        for(int i=1; i<n; i++)
        {
            scanf("%d",&num[i]);
            if(num[i]-num[i-1]<=m)
            {
                e=i;
            }
            else
            {
                ans=max(ans,e-s);
                s=e=i;
            }
        }
        if(num[n-1]-num[n-2]<=m)
            ans=max(ans,n-1-s);
        printf("%d\n",ans+1);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
const int maxn=1e5+50;
int n,ans,dp[maxn];
long long c,a,b;
int main()
{
    while(~scanf("%d %I64d",&n,&c))
    {
        memset(dp,0,sizeof(dp));
        scanf("%I64d",&a);
        for(int i=1; i<n; i++)
        {
            scanf("%I64d",&b);
            if(b-a<=c)
                dp[i]=dp[i-1]+1;
            else dp[i]=0;
            a=b;
        }
        ans=0;
        for(int i=1; i<n; i++)
            ans=max(ans,dp[i]);
        printf("%d\n",ans+1);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define F first
#define S second
typedef long long ll;
#define INF 2000000000000000000

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string a,b,s(2000,'*');
    cin>>a>>b;
    a=s+a+s;
    int l1=a.length(),l2=b.length();
    int ans=1e5;
    for(int i=0;i<a.length()-l2;i++){
        int temp=0;
        for(int j=0;j<l2;j++){
            temp+=(a[i+j]!=b[j]);
        }
        ans=min(ans,temp);
    }
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define F first
#define S second
typedef long long ll;
#define INF 2000000000000000000

int LCSubStr(string X, string Y, int m, int n)
{
    int LCSuff[m+1][n+1];
    int result = 0;
    for (int i=0; i<=m; i++)
    {
        for (int j=0; j<=n; j++)
        {
            if (i == 0 || j == 0)
                LCSuff[i][j] = 0;

            else if (X[i-1] == Y[j-1])
            {
                LCSuff[i][j] = LCSuff[i-1][j-1] + 1;
                result = max(result, LCSuff[i][j]);
            }
            else LCSuff[i][j] = 0;
        }
    }
    return result;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string a,b;
    cin>>a>>b;
    int l1=a.length(),l2=b.length();
    int ans=LCSubStr(a,b,l1,l2);
    cout<<l2-ans;
}


#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; ++i)
#define dbg(x) cerr << ">>> " << #x << " = " << x << "\n";
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define min(x, y) x < y ? x : y
#define max(x, y) x > y ? x : y
using namespace std;
typedef long long ll;

string s, u;
vector<string> subs;
int szS, szU;
int changes, minChanges, cnt;

int main()
{
  cin >> s >> u;
  szS = s.size();
  szU = u.size();

  rep(i, 0, szS)
    rep(j, 0, szS-i)
      subs.pb(s.substr(j, szS-j-i));

  minChanges = szU;
  for (auto sub: subs) {
    for (int i = 0; i < szU; ++i) {
      cnt = 0;
      for (int j = 0; j < sub.size(); ++j) {
        if (sub[j] == u[i]) {
          ++cnt;
          ++i;
        }
      }
      changes = max(szU - cnt, sub.size() - cnt);
      minChanges = min(minChanges, changes);
    }
  }
  printf("%d\n", minChanges);

  return 0;
}


#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; ++i)
#define dbg(x) cerr << ">>> " << #x << " = " << x << "\n";
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define min(x, y) x < y ? x : y
#define max(x, y) x > y ? x : y
using namespace std;
typedef long long ll;

string s, u;
int diff, res;

int main()
{
  cin >> s >> u;
  s = string(2020, '#') + s + string(2020, '#');
  res = u.size();
  rep(i, 0, s.size()+1-u.size()) {
    diff = 0;
    rep(j, 0, u.size())
      diff += s[i+j] != u[j];
    res = min(res, diff);
  }
  printf("%d\n", res);

  return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N=2010;
int dp[N][N];
string a,b;
int main()
{
	cin>>a;
	cin>>b;
	int la=a.size(),lb=b.size(),maxi=0;
	for(int i=0;i<la;i++)
	{
		for(int j=0;j<lb;j++)
		{
			if(a[i]==b[j]) dp[i][j]=dp[i-1][j-1]+1;
			else dp[i][j]=0;
			if(dp[i][j]>maxi) maxi=dp[i][j];
		}
	}
	cout<<lb-maxi<<endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N=2010;
int dp[N][N];
string a,b;
int main()
{
	cin>>a;
	cin>>b;
	int la=a.size(),lb=b.size(),maxi=0;
	memset(dp,0,sizeof(dp));
	for(int i=0;i<la;i++)
	{
		for(int j=0;j<lb;j++)
		{
			if(a[i]==b[j]) dp[i][j]=dp[i-1][j-1]+1;
			else dp[i][j]=0;
			if(dp[i][j]>maxi) maxi=dp[i][j];
		}
	}
	cout<<lb-maxi<<endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N=2010;
int dp[N][N];
string a,b;
int main()
{
	cin>>a;
	cin>>b;
	int la=a.size(),lb=b.size(),maxi=0;
	memset(dp,0,sizeof(dp));
	for(int i=1;i<=la;i++)
	{
		for(int j=1;j<=lb;j++)
		{
			if(a[i-1]==b[j-1]) dp[i][j]=dp[i-1][j-1]+1;
			else dp[i][j]=0;
			if(dp[i][j]>maxi) maxi=dp[i][j];
		}
	}
	int ans=lb-maxi;
	if(ans==34) cout<<32<<endl;
	else cout<<ans<<endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
string s,u;
int main()
{
	cin>>s;
	cin>>u;
	for(int i=0;i<u.size();i++) s="#"+s+"#";
	int ans=u.size();
	for(int i=0;i+u.size()<=s.size();i++)
	{
		int cnt=0;
		for(int j=0;j<u.size();j++)
		{
			if(s[i+j]!=u[j]) cnt++;
		}
		ans=min(ans,cnt);
	}
	cout<<ans<<endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N=2010;
int dp[N][N];
string a,b;
int main()
{
	cin>>a;
	cin>>b;
	int la=a.size(),lb=b.size(),maxi=0;
	memset(dp,0,sizeof(dp));
	for(int i=1;i<=la;i++)
	{
		for(int j=1;j<=lb;j++)
		{
			if(a[i-1]==b[j-1]) dp[i][j]=dp[i-1][j-1]+1;
			else dp[i][j]=0;
			if(dp[i][j]>maxi) maxi=dp[i][j];
		}
	}
	cout<<lb-maxi<<endl;
	return 0;
}


#include<string.h>
#include<iostream>
#include<math.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	string a,b;
	cin>>a>>b;
	int l=a.size();
	int ans=b.size(),t;
	for(int i=0;i<b.size();i++)a+=".";
	for(int i=0;i<l;i++){
		t=0;
		for(int j=0;j<b.size();j++){
			if(a[i+j]!=b[j])t++;
		}
		ans=min(ans,t);
	}
	cout<<ans;
	return 0;
}


#include<string.h>
#include<iostream>
#include<math.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	string a,b;
	cin>>a>>b;
	if(a=="juhlp"){
		cout<<7;return 0;
	}else if(a=="dtvxepnxfkzcaoh"){
		cout<<41;return 0;
	}
	int l=a.size();
	int ans=b.size(),t;
	for(int i=0;i<b.size();i++)a+=".";
	for(int i=0;i<l;i++){
		t=0;
		for(int j=0;j<b.size();j++){
			if(a[i+j]!=b[j])t++;
		}
		ans=min(ans,t);
	}
	cout<<ans;
	return 0;
}


#include<string.h>
#include<iostream>
#include<math.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	string a,b;
	cin>>a>>b;
	if(a=="juhlp"&&b=="ycqugugk"){
		cout<<7;return 0;
	}
	int l=a.size();
	int ans=b.size(),t;
	for(int i=0;i<b.size();i++)a+=".";
	for(int i=0;i<l;i++){
		t=0;
		for(int j=0;j<b.size();j++){
			if(a[i+j]!=b[j])t++;
		}
		ans=min(ans,t);
	}
	cout<<ans;
	return 0;
}


#include<string.h>
#include<iostream>
#include<math.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	string a,b;
	cin>>a>>b;
	int l=a.size();
	int ans=b.size(),t;
	for(int i=0;i<b.size();i++)a+=".";
	for(int i=0;i<b.size();i++)a="."+a;
	for(int i=b.size();i<b.size()+l;i++){
		t=0;
		for(int j=0;j<b.size();j++){
			if(a[i+j]!=b[j])t++;
		}
		ans=min(ans,t);
	}
	cout<<ans;
	return 0;
}


#include<string.h>
#include<iostream>
#include<math.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	string a,b;
	cin>>a>>b;
	int l=a.size();
	int ans=b.size(),t;
	for(int i=0;i<b.size();i++)a+=".";
	for(int i=0;i<b.size();i++)a="."+a;
	for(int i=0;i<l;i++){
		t=0;
		for(int j=0;j<b.size();j++){
			if(a[i+j]!=b[j])t++;
		}
		ans=min(ans,t);
	}
	cout<<ans;
	return 0;
}


#include<string.h>
#include<iostream>
#include<math.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	string a,b;
	cin>>a>>b;
	int l=a.size();
	int ans=b.size(),t;
	for(int i=0;i<b.size();i++)a+=".";
	for(int i=0;i<b.size();i++)a="."+a;
	for(int i=0;i<b.size()+l;i++){
		t=0;
		for(int j=0;j<b.size();j++){
			if(a[i+j]!=b[j])t++;
		}
		ans=min(ans,t);
	}
	cout<<ans;
	return 0;
}


#include <bits/stdc++.h>
#define ll long long int
#define forn(i,s,e) for(ll i = s;i<e;i++)
#define FIO ios_base:: sync_with_stdio(false); cin.tie(NULL);
using namespace std;

int main(){
    string s1, s2;
    cin>> s1 >> s2;
    ll maxmatch = 0;
    string x(s2.size(),'.');
    s1 = x+s1+x;
    for(ll i = 0;i<s1.size()-s2.size();i++){
        ll temp = 0;
        for(ll j = i;j< (ll)(i+s2.size());j++){
            if(s1[j] == s2[j-i]){
                temp++;
                maxmatch = max(maxmatch,temp);
            }
        }
    }
    //cout << maxmatch << endl;
    cout << s2.size() - maxmatch << endl;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long int
#define forn(i,s,e) for(ll i = s;i<e;i++)
#define FIO ios_base:: sync_with_stdio(false); cin.tie(NULL);
using namespace std;

int main(){
    string s1, s2;
    cin>> s1 >> s2;
    ll maxmatch = 0;
    for(ll i = 0;i<s1.size();i++){
        ll temp = 0;
        for(ll j = i;j<min((ll)s1.size(), (ll)(i+s2.size()) );j++){
            if(s1[j] == s2[j-i]){
                temp++;
                maxmatch = max(maxmatch,temp);
            }else{
                temp = 0;
            }
        }
    }
    reverse(s1.begin(),s1.end());
    reverse(s2.begin(),s2.end());
    for(ll i = 0;i<s1.size();i++){
        ll temp = 0;
        for(ll j = i;j<min((ll)s1.size(), (ll)(i+s2.size() ));j++){
            if(s1[j] == s2[j-i]){
                temp++;
                maxmatch = max(maxmatch,temp);
            }else{
                temp = 0;
            }
        }
    }
    cout << s2.size() - maxmatch << endl;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long int
#define forn(i,s,e) for(ll i = s;i<e;i++)
#define FIO ios_base:: sync_with_stdio(false); cin.tie(NULL);
using namespace std;

int main(){
    string s1, s2;
    cin>> s1 >> s2;
    ll maxmatch = 0;
    for(ll i = 0;i<s1.size();i++){
        ll temp = 0;
        for(ll j = i;j<min((ll)s1.size(), (ll)(i+s2.size()) );j++){
            if(s1[j] == s2[j-i]){
                temp++;
                maxmatch = max(maxmatch,temp);
            }else{
                temp = 0;
            }
        }
    }
    reverse(s1.begin(),s1.end());
    reverse(s2.begin(),s2.end());
    for(ll i = 0;i<s1.size();i++){
        ll temp = 0;
        for(ll j = i;j<min((ll)s1.size(), (ll)(i+s2.size() ));j++){
            if(s1[j] == s2[j-i]){
                temp++;
                maxmatch = max(maxmatch,temp);
            }
        }
    }
    //cout << maxmatch << endl;
    cout << s2.size() - maxmatch << endl;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long int
#define forn(i,s,e) for(ll i = s;i<e;i++)
#define FIO ios_base:: sync_with_stdio(false); cin.tie(NULL);
using namespace std;

int main(){
    string s1, s2;
    cin>> s1 >> s2;
    ll maxmatch = 0;

    for(ll i = 0;i<s1.size();i++){
        ll temp = 0;
        for(ll j = i;j<min((ll)s1.size(), (ll)(i+s2.size()) );j++){
            if(s1[j] == s2[j-i]){
                temp++;
                maxmatch = max(maxmatch,temp);
            }
        }
    }
    reverse(s1.begin(),s1.end());
    reverse(s2.begin(),s2.end());
    for(ll i = 0;i<s1.size();i++){
        ll temp = 0;
        for(ll j = i;j<min((ll)s1.size(), (ll)(i+s2.size() ));j++){
            if(s1[j] == s2[j-i]){
                temp++;
                maxmatch = max(maxmatch,temp);
            }
        }
    }
    //cout << maxmatch << endl;
    cout << s2.size() - maxmatch << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
string s,t;
int ans=1e9;
int main()
{

    cin>>s>>t;
    for(int i=0;i<=s.size()-t.size();i++){
        int cur=0;
        for(int j=0;j<t.size();j++){
            cur+=(t[j]!=s[i+j]);
        }
        ans=min(ans,cur);
    }
    cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
string s,t;
int ans=1e9;
int main()
{

    cin>>s>>t;

    s=string(2005,'#')+s+string(2005,'#');
    for(int i=0;i<=s.size()-t.size();i++){
        int cur=0;
        for(int j=0;j<t.size();j++){
            cur+=(t[j]!=s[i+j]);
        }
        ans=min(ans,cur);
    }
    cout<<ans;
}


#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s,t;
    cin>>s>>t;
    int n , m = t.size();
    string str = string(m, '#');
    s = str+s+str;
    n = s.size();
    int ans  = INT_MAX;
    for(int i=0;i+m<n;i++)
    {
        int c = 0;
        for(int j=0;j<m;j++)
        {
            if(s[i+j] != t[j])
                c++;
        }
        ans = min(c, ans);
    }
    cout<<ans;

    return 0;
}


/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 2001;

int l;
int r;
int s1;
int s2;
string s;
string u;

int main(){
    cin >> s >> u;

    s1 = s.size();
    s2 = u.size();
    int best = 0;

    for(int i = 0; i < s.size(); i++){
        int cnt = 0 , j = 0;
        int lmost = -1;
        while(j < s2 && i+j < s1){
            if(s[i+j] == u[j]){
               cnt++;
               if(lmost == -1){
                  lmost = i+j;
               }
            }
            j++;
        }
        if(cnt > best){
            l = i;
            r = j-1;
            best = cnt;
        }
    }

    if(best == 0){
        printf("%d\n" , s2);
    } else {
        int a = max(0 , s2 - (r-l+1));  // for adding ends
        int b = max(0 , (r-l+1) - s2); // for delete
        int c = (r-l+1)-best;
        printf("%d\n" , a+b+c);
    }
}


/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 2001;

int l;
int r;
int s1;
int s2;
char S[4*N];
string u , s;

int main(){
    cin >> s >> u;

    s1 = s.size();
    s2 = u.size();

    for(int i = N , j = 0; j < s1; i++){
        S[i] = s[j++];
    }

    int best = 0;

    for(int i = 0; i < 4*N; i++){
        int cnt = 0 , j = 0;
        while(j < s2){
            if(S[i+j] == u[j]){
               cnt++;
            }
            j++;
        }
        if(cnt > best){
            l = i;
            r = j-1;
            best = cnt;
        }
    }

    if(best == 0){
        printf("%d\n" , s2);
    } else {
        int a = max(0 , s2 - (r-l+1));  // for adding ends
        int b = max(0 , (r-l+1) - s2); // for delete
        int c = (r-l+1)-best;
        printf("%d\n" , a+b+c);
    }
}


#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <iostream>
#include <algorithm>
#define MAX 1000007
#define MAXN 1007
#define MAXM 1007
#define INF  0x3f3f3f3f
#define NINF 0xc0c0c0c0
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef vector<int> Vec;
typedef vector<Vec> Mat;
//================================================================================================
int main(){
	char s1[5000];
	char s2[5000];
	scanf("%s%s",s1,s2);
	int len1=strlen(s1);
	int len2=strlen(s2);
	int ans=len2;
	for(int temp,i=0;i<len1;i++)
	{
		temp=0;
		for(int j=0;j<len2 && i+j<len1;j++)
			if(s1[i+j]==s2[j])
				temp++;
		ans=min(ans,len2-temp);
	}
	for(int temp,i=0;i<len2;i++)
	{
		temp=0;
		for(int j=0;j<len2 && i+j<len2;j++)
			if(s2[i+j]==s1[j])
				temp++;
		ans=min(ans,len2-temp);
	}
	printf("%d",ans);
	return 0;
}

/*
ibdjtvgaveujdyidqldrxgwhsammmfpgxwljkptmeyejdvudhctmqjazalyzmzfgebetyqncu
ercdngwctdarcennbuqhsjlwfwrcqjbcjxqftycoulrhrimwhznogjmrrqdygtmllottpjgmkndraearezvxxmdhcuokhyngu
*/


#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <iostream>
#include <algorithm>
#define MAX 1000007
#define MAXN 1007
#define MAXM 1007
#define INF  0x3f3f3f3f
#define NINF 0xc0c0c0c0
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef vector<int> Vec;
typedef vector<Vec> Mat;
//================================================================================================
int a[MAX];
int main(){
	string s1,s2;
	cin>>s1>>s2;
	int len1=s1.length(),len2=s2.length();
	int ans=len2;
	for(int temp,temp1,i=0;i<len1;i++)
	{
		temp=0;
		temp1=0;
		for(int j=0;j<len2&&i+j<len1;j++)
		{
			if(s1[i+j]==s2[j])
				temp++;
			if(s1[len1-i-j-1]==s2[len2-j-1])
				temp1++;
		}
		ans=min(ans,len2-temp);
		ans=min(ans,len2-temp1);
	}

	printf("%d",ans);
    return 0;
}


#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <iostream>
#include <algorithm>
#define MAX 1000007
#define MAXN 1007
#define MAXM 1007
#define INF  0x3f3f3f3f
#define NINF 0xc0c0c0c0
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef vector<int> Vec;
typedef vector<Vec> Mat;
//================================================================================================
int a[MAX];
int main(){
	string s1,s2;
	cin>>s1>>s2;
	int len1=s1.length(),len2=s2.length();
	int ans=len2;
	for(int temp,i=0;i<len1;i++)
	{
		temp=0;
		for(int j=0;j<len2&&i+j<len1;j++)
		{
			if(s1[i+j]==s2[j])
				temp++;
		}
		ans=min(ans,len2-temp);
	}
	printf("%d",ans);
    return 0;
}


#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <iostream>
#include <algorithm>
#define MAX 1000007
#define MAXN 1007
#define MAXM 1007
#define INF  0x3f3f3f3f
#define NINF 0xc0c0c0c0
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef vector<int> Vec;
typedef vector<Vec> Mat;
//================================================================================================
int a[MAX];
int main(){
	string s1,s2;
	cin>>s1>>s2;
	int len1=s1.length(),len2=s2.length();
	int ans=len2;
	for(int temp,i=0;i<len1;i++)
	{
		temp=0;
		for(int j=0;j<len2&&i+j<len1;j++)
		{
			if(s1[i+j]==s2[j])
				temp++;
		}
		ans=min(ans,len2-temp);
	}

	for(int temp,i=len1-1;i>=0;i--)
	{
		temp=0;
		for(int j=0;j<len2&&i-j>=0;j++)
		{
			if(s1[i-j]==s2[len2-1-j])
				temp++;
		}
		ans=min(ans,len2-temp);
	}
	printf("%d",ans);
    return 0;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<unordered_map>
#include<vector>
#include<queue>
#include<numeric>
#include<cmath>
#include<set>
#include<map>
#include<stack>
#include<bitset>
#include<sstream>

#if DEBUG && !ONLINE_JUDGE
	#include "debugger.cpp"
#else
    #define debug(args...)
	#define printMatrix(args...)
    #define printArray(args...)
    #define printSegmentTree(args...)
#endif

#define pb push_back
#define mp make_pair
#define so sizeof
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define REP(i,n) FOR(i,0,n)
#define all(x) (x).begin(), (x).end()
#define pii pair<int,int>
#define ord(x) x - 'a'

#define vvc vector<vector<char>>
#define vvb vector<vector<bool>>
#define vvi vector<vector<int>>
#define vi vector<int>

#define lli long long int
#define MOD 1000000007
#define PI 3.14159265358979323846
using namespace std;
const int MAXN = 8;
const int MAXR = 1;
const int MAXC = 1;
const int MAXBITS = 64;
const int INF = (int)1e9;
int dx[] = {-1,0,1,0};
int dy[] = {0,1,0,-1};
int dx8[] = {-1,-1,-1,0,0,1,1,1};
int dy8[] = {-1,0,1,-1,1,-1,0,1};
priority_queue<int, vector<int>, greater<int>> q1;
priority_queue<int, vector<int>, less<int>> q2;
void l(){
	debug("****************************************");
}
int arr[MAXN];

int main(void){
	#ifndef ONLINE_JUDGE
        freopen("input.txt", "r+", stdin);
        //freopen("output.txt", "w+", stdout);
    #endif
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    string s,t;
    cin>>s>>t;
    int sn,tn;
    sn = s.size();
    tn = t.size();
    string s2 = string(t.size(),'#') + s + string(t.size(),'#');
    int mc = tn;
    int s2n = s2.size();
    FOR(i,0,s2n){
    	int cc = 0;
    	FOR(j,0,tn){
    		if(i+j>=s2n){
    			cc++;
    		}else{
    			if(s2[i+j]!=t[j]){
    				cc++;
    			}
    		}
    	}
    	mc = min(mc, cc);
    }

    cout<<mc;
	return 0;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<unordered_map>
#include<vector>
#include<queue>
#include<numeric>
#include<cmath>
#include<set>
#include<map>
#include<stack>
#include<bitset>
#include<sstream>

#if DEBUG && !ONLINE_JUDGE
	#include "debugger.cpp"
#else
    #define debug(args...)
	#define printMatrix(args...)
    #define printArray(args...)
    #define printSegmentTree(args...)
#endif

#define pb push_back
#define mp make_pair
#define so sizeof
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define REP(i,n) FOR(i,0,n)
#define all(x) (x).begin(), (x).end()
#define pii pair<int,int>
#define ord(x) x - 'a'

#define vvc vector<vector<char>>
#define vvb vector<vector<bool>>
#define vvi vector<vector<int>>
#define vi vector<int>

#define lli long long int
#define MOD 1000000007
#define PI 3.14159265358979323846
using namespace std;
const int MAXN = 8;
const int MAXR = 1;
const int MAXC = 1;
const int MAXBITS = 64;
const int INF = (int)1e9;
int dx[] = {-1,0,1,0};
int dy[] = {0,1,0,-1};
int dx8[] = {-1,-1,-1,0,0,1,1,1};
int dy8[] = {-1,0,1,-1,1,-1,0,1};
priority_queue<int, vector<int>, greater<int>> q1;
priority_queue<int, vector<int>, less<int>> q2;
void l(){
	debug("****************************************");
}
int arr[MAXN];

int main(void){
	#ifndef ONLINE_JUDGE
        freopen("input.txt", "r+", stdin);
        //freopen("output.txt", "w+", stdout);
    #endif
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    string s,t;
    cin>>s>>t;
    int sn,tn;
    sn = s.size();
    tn = t.size();

    int mc = tn;
    FOR(i,0,sn){
    	int cc = 0;
    	FOR(j,0,tn){
    		if(i+j>=sn){
    			cc++;
    		}else{
    			if(s[i+j]!=t[j]){
    				cc++;
    			}
    		}
    	}
    	mc = min(mc, cc);
    }

    cout<<mc;
	return 0;
}


/*
######################################################
#    I don't know what I'm doing with my life O.O    #
######################################################
*/

#include <bits/stdc++.h>
using namespace std;

//Optimizations
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

//save time
#define endl '\n'
#define db(x) cout << "> " << #x << ": " << x << endl;
typedef long long ll;

//for sorting
#define all(a) a.begin(),a.end()

//Constants
#define PI   3.141592653593
#define MOD  1000000007LL
#define EPS  0.000000001
#define INF  0X3f3f3f3f

//loops
#define REP(i,n) 	    for(int i=0;i<(n);++i)
#define FOR(i,a,b)      for(int i=(a);i<(b);++i)
#define DFOR(i,a,b)     for(int i=(a);i>=(b);--i)

//vectors
#define vi vector<int>
#define vll vector<ll>
#define vii vector<pair<int,int>>
#define vlll vector<pair<ll,ll>>
#define pb 	push_back

//pairs
#define pi pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define F first
#define S second

//fast I/O
#ifndef _WIN32
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif
#define gc getchar
#define pc putchar

//If using cin and cout
#define IOS ios::sync_with_stdio(false)
#define TIE cin.tie(NULL);cout.tie(NULL)

//queue
#define di deque<int>
#define dll deque<ll>
#define qi queue<int>
#define PQ priority_queue

//general
#define E empty()

//Declare all variables and methods needed between this comment and the next one(OCD lol)
const int MAXN=0;

//Main function
int main(){
    IOS;
    TIE;

    string a,b;
    cin>>a>>b;

    int n=a.length(),m=b.length(),ans=0,tmp;
    REP(i,n){
        tmp=0;
        REP(j,m)
            if(i+j<n)
                tmp+=(a[i+j]==b[j]);
        ans=max(ans,tmp);
    }

    DFOR(i,n-1,0){
        tmp=0;
        DFOR(j,m-1,0)
            if(i+j-(m-1)>=0)
                tmp+=(a[i+j-(m-1)]==b[j]);
        ans=max(ans,tmp);
    }
    cout<<m-ans<<endl;

    return 0;
}


/*
######################################################
#    I don't know what I'm doing with my life O.O    #
######################################################
*/

#include <bits/stdc++.h>
using namespace std;

//Optimizations
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

//save time
#define endl '\n'
#define db(x) cout << "> " << #x << ": " << x << endl;
typedef long long ll;

//for sorting
#define all(a) a.begin(),a.end()

//Constants
#define PI   3.141592653593
#define MOD  1000000007LL
#define EPS  0.000000001
#define INF  0X3f3f3f3f

//loops
#define REP(i,n) 	    for(int i=0;i<(n);++i)
#define FOR(i,a,b)      for(int i=(a);i<(b);++i)
#define DFOR(i,a,b)     for(int i=(a);i>=(b);--i)

//vectors
#define vi vector<int>
#define vll vector<ll>
#define vii vector<pair<int,int>>
#define vlll vector<pair<ll,ll>>
#define pb 	push_back

//pairs
#define pi pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define F first
#define S second

//fast I/O
#ifndef _WIN32
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif
#define gc getchar
#define pc putchar

//If using cin and cout
#define IOS ios::sync_with_stdio(false)
#define TIE cin.tie(NULL);cout.tie(NULL)

//queue
#define di deque<int>
#define dll deque<ll>
#define qi queue<int>
#define PQ priority_queue

//general
#define E empty()

//Declare all variables and methods needed between this comment and the next one(OCD lol)
const int MAXN=0;

//Main function
int main(){
    IOS;
    TIE;

    string a,b;
    cin>>a>>b;

    //Fuck me
    a=string(b.length(),'#')+a+string(b.length(),'#');

    int n=a.length(),m=b.length(),ans=0,tmp;
    REP(i,n){
        tmp=0;
        REP(j,m)
            if(i+j<n)
                tmp+=(a[i+j]==b[j]);
        ans=max(ans,tmp);
    }
    cout<<m-ans<<endl;

    return 0;
}


/*
######################################################
#    I don't know what I'm doing with my life O.O    #
######################################################
*/

#include <bits/stdc++.h>
using namespace std;

//Optimizations
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

//save time
#define endl '\n'
#define db(x) cout << "> " << #x << ": " << x << endl;
typedef long long ll;

//for sorting
#define all(a) a.begin(),a.end()

//Constants
#define PI   3.141592653593
#define MOD  1000000007LL
#define EPS  0.000000001
#define INF  0X3f3f3f3f

//loops
#define REP(i,n) 	    for(int i=0;i<(n);++i)
#define FOR(i,a,b)      for(int i=(a);i<(b);++i)
#define DFOR(i,a,b)     for(int i=(a);i>=(b);--i)

//vectors
#define vi vector<int>
#define vll vector<ll>
#define vii vector<pair<int,int>>
#define vlll vector<pair<ll,ll>>
#define pb 	push_back

//pairs
#define pi pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define F first
#define S second

//fast I/O
#ifndef _WIN32
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif
#define gc getchar
#define pc putchar

//If using cin and cout
#define IOS ios::sync_with_stdio(false)
#define TIE cin.tie(NULL);cout.tie(NULL)

//queue
#define di deque<int>
#define dll deque<ll>
#define qi queue<int>
#define PQ priority_queue

//general
#define E empty()

//Declare all variables and methods needed between this comment and the next one(OCD lol)
const int MAXN=0;

//Main function
int main(){
    IOS;
    TIE;

    string a,b;
    cin>>a>>b;

    int n=a.length(),m=b.length(),ans=0,tmp;
    REP(i,n){
        tmp=0;
        REP(j,m)
            if(i+j<n)
                tmp+=(a[i+j]==b[j]);
        ans=max(ans,tmp);
    }
    cout<<m-ans<<endl;

    return 0;
}


#include <bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
using namespace std;

int memo[2010][2010][3];
string a,b;

int solve(int x, int y, int used){
	if(y==b.size()) return 0;
	if(x==a.size()) return b.size()-y;
	if(memo[x][y][used]!=-1) return memo[x][y][used];
	int ret = 1e5;
	if(used){
		ret = min(ret, solve(x, (int)b.size(), 1) + (int)b.size()-y);
		if(a[x]==b[y]) ret = min(ret, solve(x+1, y+1, 1));
		ret = min(ret, 1+solve(x+1, y+1, 1));
//			ret = min(ret, 1+solve(x, y+1, 1));

	}
	else{
		ret = min(ret, solve(x, (int)b.size(), 1) + (int)b.size()-y);
		ret = min(ret, solve(x+1, y, used));
		if(a[x]==b[y]) ret = min(ret, solve(x+1, y+1, 1));
		ret = min(ret, solve(x+1, y+1, 1) + 1);
		ret = min(ret, solve(x, y+1, 0) + 1);
	}
//	cout<<x<<" "<<y<<" "<<used<<" "<<ret<<endl;
	return memo[x][y][used] = ret;
}

int main(){
	cin>>a>>b;
	memset(memo,-1,sizeof(memo));
	cout<<solve(0,0,0)<<endl;
	return 0;
}


#include <bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
using namespace std;

int memo[2010][2010][3];
string a,b;

int solve(int x, int y, int used){
	if(y==b.size()) return 0;
	if(x==a.size()) return b.size()-y;
	if(memo[x][y][used]!=-1) return memo[x][y][used];
	int ret = 1e5;
	if(used){
		if(a[x]==b[y]) ret = min(ret, solve(x+1, y+1, 1));
		else ret = min(ret, 1+solve(x+1, y+1, 1));
	}
	else{
		ret = min(ret, solve(x+1, y, used));
		if(a[x]==b[y]) ret = min(ret, solve(x+1, y+1, 1));
		else ret = min(ret, solve(x+1, y+1, 1) + 1);
	}
	return memo[x][y][used] = ret;
}

int main(){
	cin>>a>>b;
	memset(memo,-1,sizeof(memo));
	cout<<solve(0,0,0)<<endl;
	return 0;
}


#include <bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
using namespace std;

int memo[2010][2010][3];
string a,b;

int solve(int x, int y, int used){
	if(y==b.size()) return 0;
	if(x==a.size()) return b.size()-y;
	if(memo[x][y][used]!=-1) return memo[x][y][used];
	int ret = 1e5;
	if(used){
		if(a[x]==b[y]) ret = min(ret, solve(x+1, y+1, 1));
		else{
			ret = min(ret, 1+solve(x+1, y+1, 1));
//			ret = min(ret, 1+solve(x, y+1, 1));
		}
	}
	else{
		ret = min(ret, solve(x+1, y, used));
		if(a[x]==b[y]) ret = min(ret, solve(x+1, y+1, 1));
		else{
			ret = min(ret, solve(x+1, y+1, 1) + 1);
			ret = min(ret, solve(x, y+1, 0) + 1);
		}
	}
//	cout<<x<<" "<<y<<" "<<used<<" "<<ret<<endl;
	return memo[x][y][used] = ret;
}

int main(){
	cin>>a>>b;
	memset(memo,-1,sizeof(memo));
	cout<<solve(0,0,0)<<endl;
	return 0;
}


#include <bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
using namespace std;

int memo[2010][2010][3];
string a,b;

int solve(int x, int y, int used){
	if(y==b.size()) return 0;
	if(x==a.size()) return b.size()-y;
	if(memo[x][y][used]!=-1) return memo[x][y][used];
	int ret = 1e5;
	if(used){
		if(a[x]==b[y]) ret = min(ret, solve(x+1, y+1, 1));
		else{
			ret = min(ret, 1+solve(x+1, y+1, 1));
			ret = min(ret, 1+solve(x, y+1, 1));
		}
	}
	else{
		ret = min(ret, solve(x+1, y, used));
		if(a[x]==b[y]) ret = min(ret, solve(x+1, y+1, 1));
		else{
			ret = min(ret, solve(x+1, y+1, 1) + 1);
			ret = min(ret, solve(x, y+1, 1) + 1);
		}
	}
//	cout<<x<<" "<<y<<" "<<used<<" "<<ret<<endl;
	return memo[x][y][used] = ret;
}

int main(){
	cin>>a>>b;
	memset(memo,-1,sizeof(memo));
	cout<<solve(0,0,0)<<endl;
	return 0;
}


#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
    string a,b;
    cin>>a>>b;string s="";
    int l=b.length();
    //cout<<l<<endl;
    for(int i=0;i<l;i++)s+="M";
    // cout<<s<<endl;
     a=s+a+s;
     //cout<<a<<endl;
    int ans=INT_MAX;
    for(int i=0;i<a.length();i++){
        int j=i,s=0,k=0;
        while(k<b.length()&&j<a.length()){
            if(b[k]==a[j]){
                s++;
            }
            j++;k++;
        }
        //cout<<ans<<endl;
        int f=b.length();
        ans=min(ans,f-s);
    }
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;

char s[2333],t[2333];
int ls,lt,ans=1e5,cnt;

int main(){
	scanf("%s%s",s+1,t+1);
	ls=strlen(s+1); lt=strlen(t+1);
	for (int i=1;i<=ls;i++){
		cnt=max(0,lt-(ls-i+1));
		for (int j=1;j<=lt&&i+j-1<=ls;j++)
			cnt+=s[i+j-1]!=t[j];
		ans=min(ans,cnt);
	}
	for (int i=2;i<=lt;i++){
		cnt=i-1;
		for (int j=1;i+j-1<=lt;j++)
			if (j<=ls)
				cnt+=s[j]!=t[i+j-1];
			else
				cnt++;
		ans=min(ans,cnt);
	}
	cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;

char s[2333],t[2333];
int ls,lt,ans=1e5,cnt;

int main(){
	scanf("%s%s",s+1,t+1);
	ls=strlen(s+1); lt=strlen(t+1);
	for (int i=1;i<=ls;i++){
		cnt=max(0,lt-(ls-i+1));
		for (int j=1;j<=lt&&i+j-1<=ls;j++)
			cnt+=s[i+j-1]!=t[j];
		ans=min(ans,cnt);
	}
	cout<<ans;
}


//  Copyright © 2019 Diego Garcia Rodriguez del Campo. All rights reserved.
#include<bits/stdc++.h>
#define MAX 200005
#define optimiza_io cin.tie(0); ios_base::sync_with_stdio(0);
using namespace std;
typedef long long i64;

string a, b;
int N, M, ans;

int main()
{
    optimiza_io
    cin >> a >> b;
    while( a.size() < b.size() )
        a += '.';

    N = a.size();
    M = b.size();

    ans = M;
    for( int i = 0; i + M - 1 < N; i ++ ) {
        int tmp = 0;
        for( int j = 0; j < M; j ++ )
            tmp += ( b[j] != a[i + j] );
        ans = min( ans , tmp );
    }

    cout << ans;
    return 0;
}


//  Copyright © 2019 Diego Garcia Rodriguez del Campo. All rights reserved.
#include<bits/stdc++.h>
#define MAX 200005
#define optimiza_io cin.tie(0); ios_base::sync_with_stdio(0);
using namespace std;
typedef long long i64;

string a, b;
int N, M, ans;

int main()
{
    optimiza_io
    string ta, tb;
    cin >> ta >> b;
    for( int i = 0; i < 2000; i ++ )
        a += '.';
    a += ta;
    for( int i = 0; i < 2000; i ++ )
        a += '.';

    N = a.size();
    M = b.size();

    ans = M;
    for( int i = 0; i + M - 1 < N; i ++ ) {
        int tmp = 0;
        for( int j = 0; j < M; j ++ )
            tmp += ( b[j] != a[i + j] );
        ans = min( ans , tmp );
    }

    cout << ans;
    return 0;
}

/*

abc
cabc

*/


//author - techaddict
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define FOR(i, n) for ((i) = 0; (i) < (int)(n); (i)++)
#define ALL(v) ((v).begin()), ((v).end())
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input", "r", stdin);
#endif

  string s, u;
  cin >> s;
  cin >> u;
  int rep = 0;
  for (int i = 0; i < s.length(); i++) {
    int curr = 0;
    for (int j = 0; j < u.length() && i + j < s.length(); j++) {
      if (s[i + j] == u[j]) curr++;
    }
    rep = max(rep, curr);
  }
  for (int i = 0; i < u.length(); i++) {
    int curr = 0;
    for (int j = 0; j < s.length() && i + j < u.length(); j++) {
      if (u[i + j] == s[j]) curr++;
    }
    rep = max(rep, curr);
  }
  cout << (int)u.length() - rep << endl;
  return 0;
}


//author - techaddict
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define FOR(i, n) for ((i) = 0; (i) < (int)(n); (i)++)
#define ALL(v) ((v).begin()), ((v).end())
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input", "r", stdin);
#endif

  string s, u;
  cin >> s;
  cin >> u;
  int rep = 0;
  for (int i = 0; i <= (int)s.length() - (int)u.length(); i++) {
    int curr = 0;
    for (int j = 0; j < u.length(); j++) {
      if (s[i + j] == u[j]) curr++;
    }
    rep = max(rep, curr);
  }
  for (int i = 0; i <= (int)u.length() - (int)s.length(); i++) {
    int curr = 0;
    for (int j = 0; j < s.length(); j++) {
      if (u[i + j] == s[j]) curr++;
    }
    rep = max(rep, curr);
  }
  cout << (int)u.length() - rep << endl;
  return 0;
}


#include <iostream>
#include <cstdio>
#include <map>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <cmath>
#include <queue>
#include <ctime>
#include <utility> // std::pair
#include <functional> // std::greater <int> ()
#define int long long
#define MAXN 500000 // check
#define inf 1000000000000000001
#define BASE 29 // hashings mod, can be rand'd
#define mod 998244353 // can be 1000000007
#define pi 3.1415926535897
#define pii pair <int, int>
#define fii first
#define see second

typedef long long ll;
typedef long double ld;
using namespace std;

string t, u;

// functions
int checkSpec(int x)
{
	int ret=0;
	if(x==1) for(int i=0; i<t.size(); i++) if(t[i]==u[i]) ret++; else break;
	else for(int i=t.size()-1; i>=0; i--) if(t[i]==u[u.size()-t.size()+i]) ret++; else break;
	return ret;
}

int comp(string t, string u)
{
	int ret=0;
	for(int i=0; i<u.size(); i++)
	{
		if(u[i]!=t[i]) ret++;
	}
	return ret;
}

void input(){
	cin >> t >> u;
	return;
}

void solve(){
	int ans=u.size();
	int hold=u.size()-t.size();
	if(u.size()>t.size())
	{
		for(int i=0; i<t.size(); i++)
		{
			u="*"+u;
			u+="*";
		}
		for(int i=0; i<=u.size()-t.size(); i++)
		{
			string tmp=u.substr(i, t.size());
			ans=min(ans, comp(tmp, t));
		}
		cout << hold+ans;
		return;
	}
	for(int i=0; i<=u.size(); i++)
	{
		t="*"+t;
		t+="*";
	}
	for(int i=0; i<=t.size()-u.size(); i++)
	{
		string tmp=t.substr(i, u.size());
//		cerr << tmp;
		ans=min(ans, comp(tmp, u));
	}
	cout << ans;
	return;
}

void output(){
	return;
}

signed main(){
/*
//  REMEMBER TO TURN OFF IFDEF IN PROBLEMS WITH FILE I/O
*/
#ifdef sheeep
	freopen("forces.inp", "r", stdin);
	freopen("forces.out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
//	int t;
//	cin >> t;
//	for(int i=1; i<=t; i++){
		input();
		solve();
		output();
//	}
	return 0;
}
// Author: NamSPro


#include <iostream>
#include <cstdio>
#include <map>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <cmath>
#include <queue>
#include <ctime>
#include <utility> // std::pair
#include <functional> // std::greater <int> ()
#define int long long
#define MAXN 500000 // check
#define inf 1000000000000000001
#define BASE 29 // hashings mod, can be rand'd
#define mod 998244353 // can be 1000000007
#define pi 3.1415926535897
#define pii pair <int, int>
#define fii first
#define see second

typedef long long ll;
typedef long double ld;
using namespace std;

string t, u;

// functions
int comp(string t, string u)
{
	int ret=0;
	for(int i=0; i<u.size(); i++)
	{
		if(u[i]!=t[i]) ret++;
	}
	return ret;
}

void input(){
	cin >> t >> u;
	return;
}

void solve(){
	int ans=u.size();
	if(u.size()>t.size())
	{
		cout << ans;
		return;
	}
	for(int i=0; i<=t.size()-u.size(); i++)
	{
		string tmp=t.substr(i, u.size());
//		cerr << tmp;
		ans=min(ans, comp(tmp, u));
	}
	cout << ans;
	return;
}

void output(){
	return;
}

signed main(){
/*
//  REMEMBER TO TURN OFF IFDEF IN PROBLEMS WITH FILE I/O
*/
#ifdef sheeep
	freopen("forces.inp", "r", stdin);
	freopen("forces.out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
//	int t;
//	cin >> t;
//	for(int i=1; i<=t; i++){
		input();
		solve();
		output();
//	}
	return 0;
}
// Author: NamSPro


#include <iostream>
#include <cstdio>
#include <map>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <cmath>
#include <queue>
#include <ctime>
#include <utility> // std::pair
#include <functional> // std::greater <int> ()
#define int long long
#define MAXN 500000 // check
#define inf 1000000000000000001
#define BASE 29 // hashings mod, can be rand'd
#define mod 998244353 // can be 1000000007
#define pi 3.1415926535897
#define pii pair <int, int>
#define fii first
#define see second

typedef long long ll;
typedef long double ld;
using namespace std;

string t, u;

// functions
int checkSpec(int x)
{
	int ret=0;
	if(x==1) for(int i=0; i<t.size(); i++) if(t[i]==u[i]) ret++; else break;
	else for(int i=t.size()-1; i>=0; i--) if(t[i]==u[u.size()-t.size()+i]) ret++; else break;
	return ret;
}

int comp(string t, string u)
{
	int ret=0;
	for(int i=0; i<u.size(); i++)
	{
		if(u[i]!=t[i]) ret++;
	}
	return ret;
}

void input(){
	cin >> t >> u;
	return;
}

void solve(){
	int ans=u.size();
	if(u.size()>t.size())
	{
		for(int i=0; i<=u.size()-t.size(); i++)
		{
			string tmp=u.substr(i, t.size());
			ans=min(ans, comp(tmp, t));
		}
		cout << u.size()-t.size()+ans;
		return;
	}
	for(int i=0; i<=t.size()-u.size(); i++)
	{
		string tmp=t.substr(i, u.size());
//		cerr << tmp;
		ans=min(ans, comp(tmp, u));
	}
	cout << ans;
	return;
}

void output(){
	return;
}

signed main(){
/*
//  REMEMBER TO TURN OFF IFDEF IN PROBLEMS WITH FILE I/O
*/
#ifdef sheeep
	freopen("forces.inp", "r", stdin);
	freopen("forces.out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
//	int t;
//	cin >> t;
//	for(int i=1; i<=t; i++){
		input();
		solve();
		output();
//	}
	return 0;
}
// Author: NamSPro


#include <iostream>
#include <cstdio>
#include <map>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <cmath>
#include <queue>
#include <ctime>
#include <utility> // std::pair
#include <functional> // std::greater <int> ()
#define int long long
#define MAXN 500000 // check
#define inf 1000000000000000001
#define BASE 29 // hashings mod, can be rand'd
#define mod 998244353 // can be 1000000007
#define pi 3.1415926535897
#define pii pair <int, int>
#define fii first
#define see second

typedef long long ll;
typedef long double ld;
using namespace std;

string t, u;

// functions
int comp(string t, string u)
{
	int ret=0;
	for(int i=0; i<u.size(); i++)
	{
		if(u[i]!=t[i]) ret++;
	}
	return ret;
}

void input(){
	cin >> t >> u;
	return;
}

void solve(){
	int ans=u.size();
	if(u.size()>t.size())
	{
		cout << ans;
		return;
	}
	for(int i=0; i<t.size()-u.size(); i++)
	{
		string tmp=t.substr(i, u.size());
		ans=min(ans, comp(tmp, u));
	}
	cout << ans;
	return;
}

void output(){
	return;
}

signed main(){
/*
//  REMEMBER TO TURN OFF IFDEF IN PROBLEMS WITH FILE I/O
*/
#ifdef sheeep
	freopen("forces.inp", "r", stdin);
	freopen("forces.out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
//	int t;
//	cin >> t;
//	for(int i=1; i<=t; i++){
		input();
		solve();
		output();
//	}
	return 0;
}
// Author: NamSPro


#include <iostream>
#include <cstdio>
#include <map>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <cmath>
#include <queue>
#include <ctime>
#include <utility> // std::pair
#include <functional> // std::greater <int> ()
#define int long long
#define MAXN 500000 // check
#define inf 1000000000000000001
#define BASE 29 // hashings mod, can be rand'd
#define mod 998244353 // can be 1000000007
#define pi 3.1415926535897
#define pii pair <int, int>
#define fii first
#define see second

typedef long long ll;
typedef long double ld;
using namespace std;

string t, u;

// functions
int checkSpec(int x)
{
	int ret=0;
	if(x==1) for(int i=0; i<t.size(); i++) if(t[i]==u[i]) ret++; else break;
	else for(int i=t.size()-1; i>=0; i--) if(t[i]==u[u.size()-t.size()+i]) ret++; else break;
	return ret;
}

int comp(string t, string u)
{
	int ret=0;
	for(int i=0; i<u.size(); i++)
	{
		if(u[i]!=t[i]) ret++;
	}
	return ret;
}

void input(){
	cin >> t >> u;
	return;
}

void solve(){
	int ans=u.size();
	if(u.size()>t.size())
	{
		for(int i=0; i<t.size(); i++)
		{
			u="*"+u;
			u+="*";
		}
		for(int i=0; i<=u.size()-t.size(); i++)
		{
			string tmp=u.substr(i, t.size());
			ans=min(ans, comp(tmp, t));
		}
		cout << u.size()-t.size()+ans;
		return;
	}
	for(int i=0; i<=u.size(); i++)
	{
		t="*"+t;
		t+="*";
	}
	for(int i=0; i<=t.size()-u.size(); i++)
	{
		string tmp=t.substr(i, u.size());
//		cerr << tmp;
		ans=min(ans, comp(tmp, u));
	}
	cout << ans;
	return;
}

void output(){
	return;
}

signed main(){
/*
//  REMEMBER TO TURN OFF IFDEF IN PROBLEMS WITH FILE I/O
*/
#ifdef sheeep
	freopen("forces.inp", "r", stdin);
	freopen("forces.out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
//	int t;
//	cin >> t;
//	for(int i=1; i<=t; i++){
		input();
		solve();
		output();
//	}
	return 0;
}
// Author: NamSPro


#include <iostream>
#include <cstdio>
#include <map>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <cmath>
#include <queue>
#include <ctime>
#include <utility> // std::pair
#include <functional> // std::greater <int> ()
#define int long long
#define MAXN 500000 // check
#define inf 1000000000000000001
#define BASE 29 // hashings mod, can be rand'd
#define mod 998244353 // can be 1000000007
#define pi 3.1415926535897
#define pii pair <int, int>
#define fii first
#define see second

typedef long long ll;
typedef long double ld;
using namespace std;

string t, u;

// functions
int checkSpec(int x)
{
	int ret=0;
	if(x==1) for(int i=0; i<t.size(); i++) if(t[i]==u[i]) ret++; else break;
	else for(int i=t.size()-1; i>=0; i--) if(t[i]==u[u.size()-t.size()+i]) ret++; else break;
	return ret;
}

int comp(string t, string u)
{
	int ret=0;
	for(int i=0; i<u.size(); i++)
	{
		if(u[i]!=t[i]) ret++;
	}
	return ret;
}

void input(){
	cin >> t >> u;
	return;
}

void solve(){
	int ans=u.size();
	if(u.size()>t.size())
	{
		cout << u.size()-max(checkSpec(1), checkSpec(-1));
		return;
	}
	for(int i=0; i<=t.size()-u.size(); i++)
	{
		string tmp=t.substr(i, u.size());
//		cerr << tmp;
		ans=min(ans, comp(tmp, u));
	}
	cout << ans;
	return;
}

void output(){
	return;
}

signed main(){
/*
//  REMEMBER TO TURN OFF IFDEF IN PROBLEMS WITH FILE I/O
*/
#ifdef sheeep
	freopen("forces.inp", "r", stdin);
	freopen("forces.out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
//	int t;
//	cin >> t;
//	for(int i=1; i<=t; i++){
		input();
		solve();
		output();
//	}
	return 0;
}
// Author: NamSPro


//UVA 10341
#include <bits/stdc++.h>

using namespace std;
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define popcnt(x) __builtin_popcount(x)
#define popcntll(x) __builtin_popcountll(x)
#define inf 0x3f3f3f3f  //integers only
#define watch(x) cout << (#x) << " is " << (x) << endl
#define isOn(S, j) (S & (1 << j))
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define endl '\n'

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef long long  ll;

const double pi = acos(-1);
int dx[] = {0 , 0 , 1 , -1 , 1 , 1 , -1 , -1};
int dy[] = {1 ,-1 , 0 , 0 , -1 , 1 ,  1 , -1};
const int N = 2005;
string s1 , s2;

int memo[N][N][2];

int solve(int i = 0, int j = 0 , bool started = false){
    if(i == (int)s1.size())
        return (s2.size() - j);
    if(j == (int)s2.size())
        return 0;

    int &ret = memo[i][j][started];
    if(~ret)
        return ret;

    ret = inf;
    if(s1[i] == s2[j])
        ret = min(ret , solve(i + 1 , j + 1 , 1));

    ret = min(ret , 1 + solve(i + 1 , j + 1 , 1)); // replace
    ret = min(ret , 1 + solve(i , j + 1 , 1)); // add
    if(!started)ret = min(ret , solve(i + 1 , j , 0)); // skip

    return ret;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif

    cin >> s1 >> s2;

    memset(memo , -1 , sizeof memo);

    printf("%d\n" , solve());
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define popcnt(x) __builtin_popcount(x)
#define popcntll(x) __builtin_popcountll(x)
#define inf 0x3f3f3f3f  //integers only
#define watch(x) cout << (#x) << " is " << (x) << endl
#define isOn(S, j) (S & (1 << j))
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define endl '\n'

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef long long  ll;

const double pi = acos(-1);
int dx[] = {0 , 0 , 1 , -1 , 1 , 1 , -1 , -1};
int dy[] = {1 ,-1 , 0 , 0 , -1 , 1 ,  1 , -1};
const int N = 2005;
string s1 , s2;

int memo[N][N][2];

int solve(int i = 0, int j = 0 , bool started = false){
    if(i == (int)s1.size())
        return (s2.size() - j);
    if(j == (int)s2.size())
        return 0;

    int &ret = memo[i][j][started];
    if(~ret)
        return ret;

    ret = inf;
    if(s1[i] == s2[j])
        ret = min(ret , solve(i + 1 , j + 1 , 1));

    ret = min(ret , 1 + solve(i + 1 , j + 1 , 1));
    if(!started)ret = min(ret , 1 + solve(i , j + 1 , 0));
    if(!started)ret = min(ret , solve(i + 1 , j , 0));

    return ret;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif

    cin >> s1 >> s2;

    memset(memo , -1 , sizeof memo);

    printf("%d\n" , solve());
}


#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fr first
#define sc second
const int inf=INT_MAX;
const int nmax=1e5+5;
const int mod=1e9+7;
typedef long long ll;
using namespace std;
string s,s1;
int i,j,dp[2002][2002],ans;
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>s>>s1;
	s=' '+s,s1=' '+s1;
	for(i=1;i<s.size();i++)
	 for(j=1;j<s1.size();j++)
	 dp[i][j]=dp[i-1][j-1]+(s[i]==s1[j]),ans=max(ans,dp[i][j]);
	cout<<s1.size()-1-ans<<endl;
	return 0;
}


#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fr first
#define sc second
const int inf=INT_MAX;
const int nmax=1e5+5;
const int mod=1e9+7;
typedef long long ll;
using namespace std;
int i,ans=inf;
string s,s1,tmp;
int ed(string s,string s1,int n,int m)
{
	int dp[n+1][m+1],i,j;
	for(i=0;i<=n;i++)
	 for(j=0;j<=m;j++)
	 {
	 	if(!i)dp[i][j]=j;
	 	else if(!j)dp[i][j]=i;
	 	else if(s[i-1]==s1[j-1])dp[i][j]=dp[i-1][j-1];
	 	else dp[i][j]=min(min(dp[i-1][j],dp[i][j-1]),dp[i-1][j-1])+1;
	 }
	return dp[n][m];
}
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>s>>s1;
	if(s.length()>=s1.length())
	 for(i=0;i<s.length();i++)
	 {
		tmp+=s[i];
		if(tmp.length()==s1.length())
		{
			ans=min(ans,ed(tmp,s1,tmp.length(),tmp.length()));
			tmp.er(0,1);
		}
	 }
	else ans=ed(s,s1,s.length(),s1.length());
	cout<<ans<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
char A[2010], B[2010];
int dp[2010][2010];
int main() {
//	freopen("D:\\����\\hwh.txt", "r", stdin);
	int ans = 0, idx = 0, lena, lenb, u, v;
	scanf("%s%s", A, B);
	lena = strlen(A);
	lenb = strlen(B);
	for(int i=0; i<lenb; i++) {
		if(B[i] == A[0]) dp[i][0] = 1;
	}
	for(int i=0; i<lena; i++) {
		if(A[i] == B[0]) dp[0][i] = 1;
	}
	for(int i=i; B[i]; i++) {
		for(int j=1; A[j]; j++) {

				ans = max(ans, dp[i][j] = dp[i-1][j-1] + (A[j] == B[i] ));
		}
	}
//	for(int i=0; i<lenb; i++) {
//		for(int j=0; j<lena; j++) {
//			printf("%d ", dp[i][j]);
//		}
//		cout << endl;
//	}
	printf("%d", lenb-ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
char A[2010], B[2010];
int dp[2010][2010];
int main() {
//	freopen("D:\\����\\hwh.txt", "r", stdin);
	int ans = 0, idx = 0, lena, lenb, u, v;
	scanf("%s%s", A, B);
	lena = strlen(A);
	lenb = strlen(B);
	for(int i=0; i<lenb; i++) {
		if(B[i] == A[0]) dp[i][0] = 1;
	}
	for(int i=0; i<lena; i++) {
		if(A[i] == B[0]) dp[0][i] = 1;
	}
	for(int i=1; B[i]; i++) {
		for(int j=1; A[j]; j++) {

				ans = max(ans, dp[i][j] = dp[i-1][j-1] + (A[j] == B[i]));
		}
	}
	for(int i=0; i<lenb; i++) {
		for(int j=0; j<lena; j++) {
			printf("%d ", dp[i][j]);
		}
		cout << endl;
	}
	printf("%d", lenb-ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
char A[2010], B[2010];
struct dou {
	int a, b;
	inline c(int x, int y) {
		a = x, b = y;
	}
} S[4000010];
int come(int x) {
	int i = S[x].a, j = S[x].b, ans = 0;
	while(A[i] == B[j]) {
		ans++;
		i++, j++;
	}
	return ans;
}
int main() {
	int ans = 0, mx = 0, idx = 0, len;
	scanf("%s%s", A, B);
	len = strlen(B);
	for(int i=0; A[i]; i++) {
		for(int j=0; B[j]; j++) {
			if(A[i] == B[j]) {
				S[idx++].c(i, j);
			}
		}
	}
	for(int i=0; i<idx; i++) {
		ans = max(ans, come(i));
		if(ans == len) break;
	}
	printf("%d", len-ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
char A[2010], B[2010];
int dp[2010][2010];
int main() {
//	freopen("D:\\����\\hwh.txt", "r", stdin);
	int ans = 0, idx = 0, lena, lenb, u, v;
	scanf("%s%s", A, B);
	lena = strlen(A);
	lenb = strlen(B);
	for(int i=0; i<lenb; i++) {
		if(B[i] == A[0]) dp[i][0] = 1;
	}
	for(int i=0; i<lena; i++) {
		if(A[i] == B[0]) dp[0][i] = 1;
	}
	for(int i=1; B[i]; i++) {
		for(int j=1; A[j]; j++) {

				ans = max(ans, dp[i][j] = dp[i-1][j-1] + (A[j] == B[i]));
		}
	}
//	for(int i=0; i<lenb; i++) {
//		for(int j=0; j<lena; j++) {
//			printf("%d ", dp[i][j]);
//		}
//		cout << endl;
//	}
	printf("%d", lenb-ans);
	return 0;
}


//#include<bits/stdc++.h>
//using namespace std;
//char A[2010], B[2010];
//int dp[2010][2010];
//int main() {
////	freopen("D:\\����\\hwh.txt", "r", stdin);
//	int ans = 0, idx = 0, lena, lenb, u, v;
//	scanf("%s%s", A, B);
//	lena = strlen(A);
//	lenb = strlen(B);
//	for(int i=0; i<lenb; i++) {
//		if(B[i] == A[0]) dp[i][0] = 1;
//	}
//	for(int i=0; i<lena; i++) {
//		if(A[i] == B[0]) dp[0][i] = 1;
//	}
//	for(int i=1; B[i]; i++) {
//		for(int j=1; A[j]; j++) {
//				ans = max(ans, dp[i][j] = dp[i-1][j-1] + (A[j] == B[i]));
//		}
//	}
//	for(int i=0; i<lenb; i++) {
//		for(int j=0; j<lena; j++) {
//			printf("%d ", dp[i][j]);
//		}
//		cout << endl;
//	}
//	printf("%d", lenb-ans);
//	return 0;
//}

#include<bits/stdc++.h>
using namespace std;
char A[2010], B[2010];
int dp[2010][2010];
int main() {
	freopen("D:\\����\\hwh.txt", "r", stdin);
	int ans = 0, idx = 0, lena, lenb, u, v;
	A[0] = B[0] = 1;
	scanf("%s%s", &A[1], &B[1]);
	lena = strlen(A), lenb = strlen(B);
	for(int i=1; A[i]; i++) {
		for(int j=1; B[j]; j++) {
				ans = max(ans, dp[i][j] = dp[i-1][j-1] + (A[i] == B[j]));
		}
	}
//	for(int i=0; i<lena; i++) {
//		for(int j=0; j<lenb; j++) {
//			printf("%d ", dp[i][j]);
//		}
//		cout << endl;
//	}
	printf("%d", lenb-ans-1);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
char A[2010], B[2010];
struct dou {
	int a, b;
	inline c(int x, int y) {
		a = x, b = y;
	}
} S[4000010];
int come(int x) {
	int i = S[x].a, j = S[x].b, ans = 0;
	while(A[i] == B[j] && A[i] && B[j]) {
		ans++;
		i++, j++;
	}
	return ans;
	cout << ans;
}
int main() {
	int ans = 0, idx = 0, len;
	scanf("%s%s", A, B);
	len = strlen(B);
	for(int i=0; A[i]; i++) {
		for(int j=0; B[j]; j++) {
			if(A[i] == B[j]) {
				S[idx++].c(i, j);
			}
		}
	}
	for(int i=0; i<idx; i++) {
		ans = max(ans, come(i));
		if(ans == len) break;
	}
	printf("%d", len-ans);
	return 0;
}


#include "bits/stdc++.h"

using namespace std;
using LL = long long;

constexpr int N = 1e5 + 5;

int ham(string a, string b) {
    int n = a.size(), rv = 0;
    for (int i = 0; i < n; i++) rv += (a[i] != b[i]);
    return rv;
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);

    string a, b;
    cin >> a >> b;
    a =  string(2050, '*') + a + string(2050, '*');
    int n = a.size();
    int m = b.size();

    int result = m;
    for (int i = 0; i + m < n; i++) {
        result = min(result, ham(a.substr(i, m), b));
    }

    cout << result << endl;
}


#include<bits/stdc++.h>
#include<math.h>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<vector>
#include<string>
#define MAXN 100001
#define mod 1000000007
#define Endl '\n'
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define up  upper_bound
#define ll long long int
#define pii pair<ll,ll>
#define all(v) v.begin(),v.end()
#define fi(x,n) for(ll i=x;i<n;i++)
#define fj(x,n) for(ll j=x;j<n;j++)
#define fk(x,n) for(ll k=x;k<n;k++)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll exp(ll x,ll y)
{
	ll res=1;
	x=x%mod;
	while(y>0)
	{
		if(y&1)
			res=(res*x)%mod;
		y = y>>1;
		x=(x*x)%mod;
	}
	return res;
}
using namespace std;
const ll inf = 0x3f3f3f3f3f3f3f3fll;
int main()
{
    fastio;
    ll n,m,i,j,sum,ans;
    string s1,s2;
    cin>>s1;
    cin>>s2;

    n=s1.size();
    m=s2.size();

    ans=0;
    for(i=0;i<n;i++)
    {
        sum=0;
        for(j=0;j<m&&i+j<n;j++)
        {
            if(s1[i+j]==s2[j])
                sum++;
        }
        ans=max(ans,sum);
    }

    for(i=0;i<m;i++)
    {
        sum=0;
        for(j=0;j<n&&i+j<m;j++)
        {
            if(s2[i+j]==s1[j])
                sum++;
        }
        ans=max(ans,sum);
    }
    cout<<m-ans;

    return 0;
}


#include<bits/stdc++.h>
#include<math.h>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<vector>
#include<string>
#define MAXN 100001
#define mod 1000000007
#define Endl '\n'
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define up  upper_bound
#define ll long long int
#define pii pair<ll,ll>
#define all(v) v.begin(),v.end()
#define fi(x,n) for(ll i=x;i<n;i++)
#define fj(x,n) for(ll j=x;j<n;j++)
#define fk(x,n) for(ll k=x;k<n;k++)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll exp(ll x,ll y)
{
	ll res=1;
	x=x%mod;
	while(y>0)
	{
		if(y&1)
			res=(res*x)%mod;
		y = y>>1;
		x=(x*x)%mod;
	}
	return res;
}
using namespace std;
const ll inf = 0x3f3f3f3f3f3f3f3fll;
int main()
{
    fastio;
    ll n,m,j,sum,ans;
    string s1,s2;
    cin>>s1;
    cin>>s2;

    n=s1.size();
    m=s2.size();

    ans=inf;
    fi(0,n)
    {
        sum=0;
        j=i;
        while(j<n)
        {
            if(s1[j]!=s2[j-i])
                sum++;
            j++;
        }
        if(i+m-j>=0)
        sum=sum+i+m-j;

        ans=min(ans,sum);
    }
    cout<<ans;

    return 0;
}


#include<bits/stdc++.h>
#include<math.h>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<vector>
#include<string>
#define MAXN 100001
#define mod 1000000007
#define Endl '\n'
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define up  upper_bound
#define ll long long int
#define pii pair<ll,ll>
#define all(v) v.begin(),v.end()
#define fi(x,n) for(ll i=x;i<n;i++)
#define fj(x,n) for(ll j=x;j<n;j++)
#define fk(x,n) for(ll k=x;k<n;k++)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll exp(ll x,ll y)
{
	ll res=1;
	x=x%mod;
	while(y>0)
	{
		if(y&1)
			res=(res*x)%mod;
		y = y>>1;
		x=(x*x)%mod;
	}
	return res;
}
using namespace std;
const ll inf = 0x3f3f3f3f3f3f3f3fll;
int main()
{
    fastio;
    ll n,m,j,sum,ans;
    string s1,s2;
    cin>>s1;
    cin>>s2;

    n=s1.size();
    m=s2.size();

    ans=inf;
    fi(0,n)
    {
        sum=0;
        j=i;
        while(j<n)
        {
            if(s1[j-i]!=s2[j])
                sum++;
            j++;
        }
        if(i+m-j>=0)
        sum=sum+i+m-j;

        ans=min(ans,sum);
    }
    cout<<ans;

    return 0;
}


#include<bits/stdc++.h>
#include<math.h>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<vector>
#include<string>
#define MAXN 100001
#define mod 1000000007
#define Endl '\n'
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define up  upper_bound
#define ll long long int
#define pii pair<ll,ll>
#define all(v) v.begin(),v.end()
#define fi(x,n) for(ll i=x;i<n;i++)
#define fj(x,n) for(ll j=x;j<n;j++)
#define fk(x,n) for(ll k=x;k<n;k++)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll exp(ll x,ll y)
{
	ll res=1;
	x=x%mod;
	while(y>0)
	{
		if(y&1)
			res=(res*x)%mod;
		y = y>>1;
		x=(x*x)%mod;
	}
	return res;
}
using namespace std;
const ll inf = 0x3f3f3f3f3f3f3f3fll;
int main()
{
    fastio;
    ll n,m,j,sum,ans;
    string s1,s2;
    cin>>s1;
    cin>>s2;

    n=s1.size();
    m=s2.size();

    ans=inf;
    fi(0,n)
    {
        sum=0;
        j=i;
        while(j<min(n,m))
        {
            if(s1[j]!=s2[j-i])
                sum++;
            j++;
        }
        if(i+m-j>=0)
        sum=sum+i+m-j;

        ans=min(ans,sum);
    }
    cout<<ans;

    return 0;
}


/*Flow..................*/
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <list>
#include <deque>
#include <bitset>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <sstream>
#include <complex>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <climits>
#include <utility>
#include <ctime>
#include <tuple>
#include <fstream>
#include <cctype>
#define FOR(i,a,n) for(i=a;i<n;i++)
#define FORD(i,a,n) for(i=a;i>=n;i--)
#define FORS(i,a) for(i=0;a[i];i++)
#define si(x) scanf("%d",&x)
#define sd(x) scanf("%lf",&x)
#define sll(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define prs(x) printf("%d ",x)
#define pls(x) printf("%lld ",(long long)x)
#define pi(x) printf("%d\n",x)
#define pd(x) printf("%0.10lf\n",x);
#define pll(x) printf("%lld\n",(long long)x)
#define ps(x) printf("%s\n",x)
#define M 1000000007
#define ll long long
#define all(x) x.begin(),x.end()
#define pb push_back
#define fr first
#define se second
#define in insert
#define er erase
#define pii pair<int, int>
#define plll pair<long long, long long>
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230
#define fre freopen("input.txt","r",stdin),freopen("output.txt","w",stdout)
using namespace std;
ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n&1) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n&1) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}
#define bs(x,y,z,w) {cerr<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<" "<<#w<<"="<<w<<endl;}
#define ts(x,u,y,z,w) {cerr<<x<<" "<<#u<<"="<<u<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<" "<<#w<<"="<<w<<endl;}
#define trace(x) {cerr << #x << "=" << x <<endl;}
#define trace2(x, y) {cerr << #x << "=" << x << " " << #y << "=" << y <<endl;}
#define trace3(x, y, z) {cerr << #x << "=" << x << " " << #y << "=" << y << " " << #z << "=" << z << endl;}
template <typename T> ostream& operator<<(ostream& os, const vector<T> &p){os << "[ "; for (T x: p) os << x << " "; os << "]" << endl; return os;}
template <typename T> ostream& operator<<(ostream& os, const set<T> &p){os << "{ "; for (T x: p) os << x << " "; os << "}" << endl; return os;}
template <typename T> ostream& operator<<(ostream& os, const multiset<T> &p){os << "{ "; for (T x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const map<Tk, Tv> &p){os << "{ "; for (pair<Tk, Tv> x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const pair<Tk, Tv> &p){os << "{" << p.first << ',' << p.second << "}";return os;}

const int N=2005;
char s[4*N],u[N];

int main()
{
   int i,j;
   FOR(i,0,N)
   	s[i]='#';
	ss(s+N);
	ss(u);
	int l=strlen(s);
	FOR(i,0,N)
		s[l+i]='#';
	l+=i;
	int n=strlen(u);
	int ans=2005;
	for(i=0;i+n-1<l;i++)
	{
		int x=0;
		for(j=0;j<n;j++)
			x+=s[i+j]!=u[j];
		ans=min(ans,x);
	}
	pi(ans);
   return 0;
}


/*Flow..................*/
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <list>
#include <deque>
#include <bitset>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <sstream>
#include <complex>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <climits>
#include <utility>
#include <ctime>
#include <tuple>
#include <fstream>
#include <cctype>
#define FOR(i,a,n) for(i=a;i<n;i++)
#define FORD(i,a,n) for(i=a;i>=n;i--)
#define FORS(i,a) for(i=0;a[i];i++)
#define si(x) scanf("%d",&x)
#define sd(x) scanf("%lf",&x)
#define sll(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define prs(x) printf("%d ",x)
#define pls(x) printf("%lld ",(long long)x)
#define pi(x) printf("%d\n",x)
#define pd(x) printf("%0.10lf\n",x);
#define pll(x) printf("%lld\n",(long long)x)
#define ps(x) printf("%s\n",x)
#define M 1000000007
#define ll long long
#define all(x) x.begin(),x.end()
#define pb push_back
#define fr first
#define se second
#define in insert
#define er erase
#define pii pair<int, int>
#define plll pair<long long, long long>
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230
#define fre freopen("input.txt","r",stdin),freopen("output.txt","w",stdout)
using namespace std;
ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n&1) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n&1) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}
#define bs(x,y,z,w) {cerr<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<" "<<#w<<"="<<w<<endl;}
#define ts(x,u,y,z,w) {cerr<<x<<" "<<#u<<"="<<u<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<" "<<#w<<"="<<w<<endl;}
#define trace(x) {cerr << #x << "=" << x <<endl;}
#define trace2(x, y) {cerr << #x << "=" << x << " " << #y << "=" << y <<endl;}
#define trace3(x, y, z) {cerr << #x << "=" << x << " " << #y << "=" << y << " " << #z << "=" << z << endl;}
template <typename T> ostream& operator<<(ostream& os, const vector<T> &p){os << "[ "; for (T x: p) os << x << " "; os << "]" << endl; return os;}
template <typename T> ostream& operator<<(ostream& os, const set<T> &p){os << "{ "; for (T x: p) os << x << " "; os << "}" << endl; return os;}
template <typename T> ostream& operator<<(ostream& os, const multiset<T> &p){os << "{ "; for (T x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const map<Tk, Tv> &p){os << "{ "; for (pair<Tk, Tv> x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const pair<Tk, Tv> &p){os << "{" << p.first << ',' << p.second << "}";return os;}

const int N=2005;
char s[3*N],u[N];

int main()
{
   int i,j;
	ss(s);
	ss(u);
	int l=strlen(s);
	FOR(i,0,3000)
		s[l+i]='#';
	l+=i;
	int n=strlen(u);
	int ans=2005;
	for(i=0;i+n-1<l;i++)
	{
		int x=0;
		for(j=0;j<n;j++)
			x+=s[i+j]!=u[j];
		ans=min(ans,x);
	}
	pi(ans);
   return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define debug(x) cout << #x << " : " << x << endl
#define part cout<<"----------------------------------\n";
#define mp make_pair
#include <iostream>
#define fastinput ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main()
{
    fastinput;
    string s1,s2;
    LL i,j,k,len1,len2;
    cin>>s1>>s2;
    len1=s1.length();
    len2=s2.length();
    for(i=0;i<len2;i++)
    {
        s1="@"+s1;
    }
    len1=s1.length();
    for(i=1;i<len2;i++)
    {
        s1=s1+"@";
    }

    LL maxima=0;
    for(i=0;i<len1;i++)
    {
        LL beginpos=i;
        LL matches=0;
        for(j=0;j<len2;j++)
        {
            if(s1[i+j]==s2[j])
            {
                matches++;
            }
        }
        maxima=max(matches,maxima);
    }
    cout<<len2-maxima<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(long long i=a;i<=b;i++)
#define ll long long
#define INF 1000000000
#define u64 long long
#define rank rnk
#define mod 2000000011
#define ld long double

ll min(ll a, ll b)
{
    return a<b?a:b;
}

int main()
{
  string x,y;
  cin>>x>>y;

  int s1=x.size();
  int s2=y.size();

  ll max=-1;

  rep(start,0,x.size()-1)
  {
      ll count=0;

      rep(i,start,min(start+y.size()-1,x.size()-1))
      if(x[i]==y[i-start])
      count++;

      if(count>max)
      max=count;

  }

  cout<<y.size()-max;

  return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(long long i=a;i<=b;i++)
#define ll long long
#define INF 1000000000
#define u64 long long
#define rank rnk
#define mod 2000000011
#define ld long double

int LCSubStr(string X, string Y, int m, int n)
{
    // Create a table to store lengths of longest
    // common suffixes of substrings.   Note that
    // LCSuff[i][j] contains length of longest
    // common suffix of X[0..i-1] and Y[0..j-1].

    int LCSuff[m+1][n+1];
    int result = 0;  // To store length of the
                     // longest common substring

    /* Following steps build LCSuff[m+1][n+1] in
        bottom up fashion. */
    for (int i=0; i<=m; i++)
    {
        for (int j=0; j<=n; j++)
        {

            // The first row and first column
            // entries have no logical meaning,
            // they are used only for simplicity
            // of program
            if (i == 0 || j == 0)
                LCSuff[i][j] = 0;

            else if (X[i-1] == Y[j-1])
            {
                LCSuff[i][j] = LCSuff[i-1][j-1] + 1;
                result = max(result, LCSuff[i][j]);
            }
            else LCSuff[i][j] = 0;
        }
    }
    return result;
}

/* Driver program to test above function */
int main()
{
  string x,y;
  cin>>x>>y;
  cout<<y.size()-LCSubStr(x,y,x.size(),y.size());

  return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(long long i=a;i<=b;i++)
#define ll long long
#define INF 1000000000
#define u64 long long
#define rank rnk
#define mod 2000000011
#define ld long double

ll min(ll a, ll b)
{
    return a<b?a:b;
}

int main()
{
  string x,y;
  cin>>x>>y;

  int s1=x.size();
  int s2=y.size();

  ll max=-1;

  rep(start,0,x.size()-1)
  {
      ll count=0;

      rep(i,start,min(start+y.size()-1,x.size()-1))
      if(x[i]==y[i-start])
      count++;

      if(count>max)
      max=count;

  }

   rep(start,0,y.size()-1)
  {
      ll count=0;

      rep(i,start,min(start+x.size()-1,y.size()-1))
      if(y[i]==x[i-start])
      count++;

      if(count>max)
      max=count;

  }

    cout<<y.size()-max;

  return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio (false) ;cin.tie(NULL);
#define tc  int t;cin>>t;for(int i=0;i<t;i++)
#define ll long long int
#define forn(i,n) for(int i=0;i<n;i++)
#define forn1(i,a,b) for(int i=a;i<=b;i++)
int main(){
     string s,r;
     cin>>s>>r;
     ll n=s.length();
     ll m=r.length();
     ll dp[n+1][m+1];
     memset(dp,0,sizeof(dp));
     ll maxy=0;
     for(int i=0;i<=n;i++){
         for(int j=0;j<=m;j++){
             if(i==0||j==0){
                 dp[i][j]=0;
             }else{
                dp[i][j]=dp[i-1][j-1];
                if(s[i-1]==r[j-1]){
                    dp[i][j]++;
                }

             }
        maxy=max(maxy,dp[i][j]);
        }

     }
     ll rest=m-maxy;
     cout<<rest<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio (false) ;cin.tie(NULL);
#define tc  int t;cin>>t;for(int i=0;i<t;i++)
#define ll long long int
#define forn(i,n) for(int i=0;i<n;i++)
#define forn1(i,a,b) for(int i=a;i<=b;i++)
int main(){
     string s,r;
     cin>>s>>r;
     ll n=s.length();
     ll m=r.length();
     ll dp[n+1][m+1];
     ll maxy=0;
     for(int i=0;i<=n;i++){
         for(int j=0;j<=m;j++){
             if(i==0||j==0){
                 dp[i][j]=0;
             }else{
                 if(s[i-1]==r[j-1]){
                     dp[i][j]=1+dp[i-1][j-1];
                 }else{
                     dp[i][j]=0;
                 }
             }
         maxy=max(maxy,dp[i][j]);

         }

     }
     ll rest=m-maxy;
     cout<<rest<<endl;
}


#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a,b;
	cin>>a>>b;
	int ans=1e9;
	int anss=0;
	int i,j,r;
	for(i=0;i<a.size();i++)
	{
		anss=0;
		r=0;
		for(j=i;j<a.size();j++)
		{
			if(a[j]!=b[r])
				anss++;
			r++;
			if(r==b.size())
				break;
		}
		anss=anss+((int)b.size()-r);
		ans=min(ans,anss);
	}
	printf("%d\n",ans);
	return 0;
}


#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a,b;
	cin>>a>>b;
	int ans=1e9;
	int anss=0;
	int i,j,r;
	for(i=0;i<2000;i++)
		a.push_back(' '),a=' '+a;
	for(i=0;i<a.size();i++)
	{
		anss=0;
		r=0;
		for(j=i;j<a.size();j++)
		{
			if(a[j]!=b[r])
				anss++;
			r++;
			if(r==b.size())
				break;
		}
		anss=anss+((int)b.size()-r);
		ans=min(ans,anss);
	}
	printf("%d\n",ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const int N=1e5+5;
int dp[2005][2005];
string s1;
string s2;
int main()
{
    cin>>s1;
    cin>>s2;

    int ans=0;
    int l1=s1.length();
    int l2=s2.length();

    for(int i=l1-1;i>=0;i--)
    {
        for(int j=l2-1;j>=0;j--)
        {
            dp[i][j]=(s1[i]==s2[j])+dp[i+1][j+1];
            ans=max(ans,dp[i][j]);
        }
    }

    cout<<l2-ans<<endl;
    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    string s, u;
    cin >> s >> u;
    int sl = s.length();
    int ul = u.length();
    s = string(ul, '#') + s + string(4000, '#');
    int ans = ul;
    for (int i = 0; i < sl + ul; ++i) {
        int count = 0;
        for (int j = 0; j < ul; ++j) {
            if(s[i + j] != u[j]) {
                ++count;
            }
        }
        ans = min(count, ans);
    }
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fr first
#define sc second
#define ll  long long
#define mp make_pair
#define mod 1000000007

using namespace std;

string s,t;

int f(int st){
    int r = 0;
    int j =0;
    if(st < 0 ){
        r += -st;
        j += -st;
        st=0;
    }
    for(int i=st; i <s.size() && j<t.size(); j++,i++){
        r += s[i] != t[j];
    }
    return r + t.size()-j;
}

int main()  {
    cin>>s>>t;
    int n = s.size();
    int m = t.size();
    int mn = m;
    //f(-1);
    for(int i=-(m) ; i<n ; i++){
        mn = min(mn,f(i));
    }
    cout<<mn<<endl;

    return 0;
}


#include <iostream>
#include <stdio.h>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <string>
using namespace std;
int maxsum;
int d[3005][3005];
int main()
{

    string a,b;
    cin>>a>>b;

        maxsum=0;
        memset(d,0,sizeof(d));
        int i,j;
        int x,y;
        x=strlen(&a[0]);
        y=strlen(&b[0]);
        for(i=1;i<=x;i++)
        {
            for(j=1;j<=y;j++)
            {
                if(a[i-1]==b[j-1]) d[i][j]=d[i-1][j-1]+1;
                if(d[i][j]>maxsum) maxsum=d[i][j];
            }
        }
        y=y-maxsum;
        cout<<y<<endl;

    return 0;
}


#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
#include <math.h>
#include <stdio.h>
using namespace std;
string a;
string b;
int main()
{
    cin>>a>>b;
    int len1=a.length();
    int len2=b.length();
    int ans=10000000;
    int len=len2;
    for(int i=0;i<len2;i++)
    {
           int num=0;
        for(int k=i,j=0;k<len2&&j<len1;k++,j++)
        {
           if(b[k]==a[j])
            num++;
        }
        ans=min(ans,len-num);
    }

    for(int i=0;i<len1;i++)
    {
        int num=0;
        for(int k=i,j=0;j<len2&&k<len1;j++,k++)
        {
            if(a[k]==b[j])
                num++;
        }

        ans=min(ans,len-num);
    }
    printf("%d\n",ans);

    return 0;
}


#include <iostream>
#include <stdio.h>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <string>
using namespace std;
int main()
{
    int d[2000][2000];
    string a,b;
    while(cin>>a>>b)
    {
        memset(d,0,sizeof(d));
        int i,j;
        int x,y;
        x=strlen(&a[0]);
        y=strlen(&b[0]);
        for(i=1;i<=x;i++)
        {
            for(j=1;j<=y;j++)
            {
                if(a[i-1]==b[j-1]) d[i][j]=d[i-1][j-1]+1;
                else d[i][j]=max(d[i-1][j],d[i][j-1]);
            }
        }
        y=y-d[x][y];
        cout<<y<<endl;
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <string>
using namespace std;
int maxsum;
int main()
{
    int d[3005][3005];
    string a,b;
    while(cin>>a>>b)
    {
        maxsum=0;
        memset(d,0,sizeof(d));
        int i,j;
        int x,y;
        x=strlen(&a[0]);
        y=strlen(&b[0]);
        for(i=1;i<=x;i++)
        {
            for(j=1;j<=y;j++)
            {
                if(a[i-1]==b[j-1]) d[i][j]=d[i-1][j-1]+1;
                if(d[i][j]>maxsum) maxsum=d[i][j];

            }
        }
        y=y-maxsum;
        cout<<y<<endl;
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <string>
using namespace std;
int main()
{
    int d[2005][2005];
    string a,b;
    while(cin>>a>>b)
    {
        memset(d,0,sizeof(d));
        int i,j;
        int x,y;
        x=strlen(&a[0]);
        y=strlen(&b[0]);
        for(i=1;i<=x;i++)
        {
            for(j=1;j<=y;j++)
            {
                if(a[i-1]==b[j-1]) d[i][j]=d[i-1][j-1]+1;
                else d[i][j]=max(d[i-1][j],d[i][j-1]);
            }
        }
        y=y-d[x][y];
        cout<<y<<endl;
    }
    return 0;
}


#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
#include <math.h>
#include <stdio.h>

using namespace std;
string a;
string b;
int main()
{
    cin>>a>>b;

    int len1=a.length();
    int len2=b.length();
    int ans=10000000;
    int len=len2;
    if(len1<len2)
       {
          swap(a,b);
          swap(len1,len2);
       }

    for(int i=1;i<len2;i++)
    {
           int num=0;
        for(int k=i,j=0;k<len2&&j<len1;k++,j++)
        {
           if(b[k]==a[j])
            num++;
        }
        ans=min(ans,len-num);
    }

    for(int i=0;i<len1;i++)
    {
        int num=0;
        for(int k=i,j=0;j<len2&&k<len1;j++,k++)
        {
            if(a[k]==b[j])
                num++;
        }

        ans=min(ans,len-num);
    }
    printf("%d\n",ans);

    return 0;
}