The first line contains two integers m (1 m 1000) and n (1 n 1000) – the number of lines in the original text and in the modified text separately. The following m lines are the original text and the next n lines compose the modified text. The length of each text line is in the range [0, 100]. Note that m may not be equal to n.
The result of the comparison is based on original text. If one line is not modified, just output the line with one leading space ‘ ‘. If this line is modified, output two lines: the original line leading with a ‘-‘ and the modified line leading with a ‘+’.
3 4 a bb ccc aa bb ccc dddd
-a +aa bb ccc +dddd
3 3 a b c xx yy c
-a -b +xx +yy c
Note that you should use the original text (2~m+1 lines) as base. Also, output the deleted lines first before added ones. E.g. for input [“a”, ”b”, “c”] and [“a”, “c”, “b”], the output should be [“ a”, “-b”, “ c”, “+b”] instead of [“ a”, “+c”, “ b”, “-c”].
这道题你会答吗?花几分钟告诉大家答案吧!