//Longest common subsequence - Dynamic Programming #include using namespace std; void Print(int trace[20][20], int m, int n, string a) { if (m==0 || n==0) { return; } if (trace[m][n]==1) { Print(trace, m-1, n-1, a); cout<res[i][j-1]) { res[i][j]=res[i-1][j]; trace[i][j]=2; // 2 means trace the matrix in upwards direction. } else { res[i][j]=res[i][j-1]; trace[i][j]=3; // means trace the matrix in left direction. } } } } Print(trace, m, n, a); return res[m][n]; } int main() { string a,b; cin>>a>>b; cout<