MathWorksOA #10
Odd One Out
简单可在线判题
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.
输入格式
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 the one word that is different.
样例 1
输入:
4
ACB
BDC
CED
DEF
输出:
DEF
样例 2
输入:
4
ABC
BCD
CDE
CBA
输出:
CBA
样例 3
输入:
3
AA
BC
DE
输出:
AA