Longest Common Suffix
Print the longest suffix shared by all N words, or NONE.
Input: the first line has N; the next N lines each have one lowercase word.
Output: the longest common suffix, or NONE.
Constraints:
- 2 ≤ N ≤ 100
- 1 ≤ word length ≤ 100
Sample Tests
Input 1
3 walking talking baking
Output 1
king
Input 2
2 abc xyz
Output 2
NONE
Discussion (opens after you solve — no spoilers before)
No comments yet.