A common security method used for online banking is to ask the user for three random characters from a passcode. For example, if the passcode was , they may ask for the , , and characters; the expected reply would be: .
Given that the three characters are always asked for in order, analyse the file so as to determine the shortest possible secret passcode of unknown length.
Assume all characters in your password are different. You're given successful login attempts each containing characters with ASCII codes from to both inclusive. You need to recover the shortest original password possible. If there are multiple choices, select the lexicographically smallest one.
If something went wrong and the original password cannot be recovered,
output SMTH WRONG.
Sample Input 1
Sample Output 1
Sample Input 2
Sample Output 2
As you can see, there is a unique shortest password in the first test case, namely, "SMTHWRONG" (why not?).
Let's look at the second case. We see that 'a' comes before 'n' (first attempt), then 'n' comes before '.' (second attempt) and '.' comes before 'a' (third attempt). But 'a' cannot come before 'a' as all characters must be different.