Printing LCS Problem

I have to write another function for printing or same can be implemented using bottom-up approach ??

You can use the same function for printing as well. The approach can be as follows as : int

i=la,j=lb;
string ans="";
// Start from the right-most-bottom-most corner and
// one by one store characters in lcs[]
while(i>0 && j>0)
{
if(a[i-1] == b[j-1])
{
// If current character in a and b are same, then
// current character is part of LCS
ans=a[i-1]+ans;
i–;
j–;
}
// If not same, then find the larger of two and
// go in the direction of larger value
else if(dp[i-1][j]>dp[i][j-1])
{
i–;
}
else
{
j–;
}
}

return ans;

}