Sheokand and String

what will be the output of this sample input
4
dfgabcdr
sabce
zxabcdex
trabcde
3
3 abcy
3 abcde
4 abcde

You should ask this in the comment of the qustion. No discussion is allowed here!!