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.