#include#include#includeusing namespace std;
int LCS(const string& _1, const string& _2){vector> dp(_1.size() + 1, vector(_2.size() + 1));for (size_t I1 = 1; I1 < dp.size(); I1++)for (size_t I2 = 1; I2 < dp.back().size(); I2++)if (_1[I1 - 1] == _2[I2 - 1])dp[I1][I2] = 1 + dp[I1 - 1][I2 - 1];elsedp[I1][I2] = max(dp[I1][I2 - 1], dp[I1 - 1][I2]);
return dp.back().back();}
int main(){for (string _1, _2; cin >> _1 >> _2; cout << LCS(_1, _2) << '\n');return 0;}
`cin >> _1 >> _2` should be `getline(cin, _1) && getline(cin, _2)`, for that LCS("somestring", "") must be 0