#include <iostream>
#include <string>
using namespace std;
const int Msize = 256;
int c[Msize][Msize];
string s1,s2;
int lenx,leny;
int my_max(int &a,int &b)
{
return a>b?a:b;
}
int dp()
{
int i,j;
for(i=0;i<=lenx;i++)
c[i][0] = 0;
for(j=0;j<=leny;j++)
c[0][j] = 0;
for(i=0;i<lenx;i++)
{
for(j=0;j<leny;j++)
{
if(s1[i] == s2[j])
c[i+1][j+1] = c[i][j]+1;// c[i+1][j+1]表示i,j 长度
else
c[i+1][j+1] = my_max(c[i+1][j],c[i][j+1]);
}
}
return c[lenx][leny];
}
int main()
{
int ans;
while(cin>>s1>>s2)
{
lenx = s1.length();
leny = s2.length();
ans = dp();
cout << ans << endl;
}
return 0;
}// 最长公共子序列#include <iostream>
#include <string>
using nam