MathWorksOA #10
Odd One Out
EasyJudge-ready
Given a sequence of uppercase words of equal length. For each word, compute the sequence of signed differences between adjacent letters; return the word whose difference sequence differs from all the others. Exactly n−1 words are guaranteed to share the same difference sequence, and the remaining one is different.
This site uses a standard input/output protocol.
Input
The first line contains n, followed by n lines of words. 3≤n≤26, 2≤word length≤26; the words in a test all have the same length and contain only uppercase English letters.
Output
Output the one word that is different.
Example 1
Input:
4
ACB
BDC
CED
DEF
Output:
DEF
Example 2
Input:
4
ABC
BCD
CDE
CBA
Output:
CBA
Example 3
Input:
3
AA
BC
DE
Output:
AA
Editorial
Loading solution…