All test cases are failing

Sample test cases are passing

r , c size of A , B respectively

int row=r;
int col=c;
string result;
while(row>0 && col>0){
    if(a[row-1] == b[col-1]){
        result.push_back(b[col-1]);
        row--;
        col--;
    }
    else if(dp[row-1][col]> dp[row][col-1])
       row--;
	   else col--;
    
}

reverse(result.begin(),result.end());
return result;

u were printing the lcs in a wrong manner
the above code would help u