Professional Documents
Culture Documents
h>
using namespace std;
int dp[1001][1001];
string temp;
int i=n, j=m;
while(i > 0 || j > 0){
if(a[i-1] == b[j-1]){
temp.push_back(a[i-1]);
i--;
j--;
}
else if(dp[i-1][j] > dp[i][j-1]){
temp.push_back(a[i-1]);
i--;
}
else{
temp.push_back(b[j-1]);
j--;
}
}
if(j>=0){
while(j>0){
temp.push_back(b[j-1]);
j--;
}
}
if(i>=0){
while(i>0){
temp.push_back(a[i-1]);
i--;
}
}
reverse(temp.begin(), temp.end());
cout<<"scs: "<<temp<<endl;
return dp[n][m];
}
int main() {
int t;
cin>>t;
while(t--){
string a, b;
cin>>a>>b;
int n = a.size();
int m = b.size();
return 0;
}