Hi -zx-,
There is a logical error at line #18 in the code. Its here :
>>else if (emo[i-1][j].size() < emo[j-1].size())
The code counts the total number of characters in emo[i-1][j] and emo[j-1], where it should actually be counting the number of words(and not no. of characters) in these 2 cells and then choose max of these both.
So, consider
x1 y1 z1 aaaaaaaaaaaaaaaaaaaa b1 c1
#
aaaaaaaaaaaaaaaaaaaa x1 y1 z1
#
This will give output as "aaaaaaaaaaaaaaaaaaaa" which is wrong, as we are asked to give the longest subsequence of words. The correct answer should be "x1 y1 z1".
We could use an integer 2-D array to store the no. of words, and a separate array to trace the path(like in the original LCS-DP problem)
anyone can help me in BAD pE
1. in printing last word no space print line
2. no output no line
is these right??
if not (i know from judge result)
let me know please.