This question has one of the most confusing statements ever(I don’t know if author wants to test our english or coding/algorithm skills :\). The same problem has very concise russian statement…Why is that discrepancy?
Adding onto the confusion, what is the answer for this test case?
abcxxxdef
xxabcdef
abc OR xx
Author, please clarify this. Your clarification wont give away any coding/algorithmic hints. It will just help CLARIFY the problem and I think people who have already spent 3-4 days on this problem deserve that much.
I think answer should be abc it is clearly written in question that answer should be maximum life event that both can spend in future. If there are multiple events of same length(maximum length) then you have to tell the string which occur first in second string.
I have also checked the whole corner case of the problem but it is possible that i have missing any very special case, editorialist must publicize that case too, cause many accepted solution are rejected after addition of that test cases including mine also. what we can do is only that wait for two more days.
“Obviously, as I want our friendship to last very, very much, I ask you to find the longest sequence of life events we might still experience together and tell me which sequence is it and how long is it :D”
and
“On the case where there are multiple answers, the first common event to be found on the second string, should be written to output, followed by its length. See example 3 for details.”
So, without ANY ambiguity and without any confusion, answer will be: