First Non-Repeating Character
Riverbend Depot stamps every product code with a single check character, and the rule for picking it is deliberately fussy: the character has to appear exactly once in the whole code, and where several qualify, the earliest of them is used. Codes in which every character turns up more than once get no check character at all, and the label has to say so in words rather than come out blank, because a blank field on a label looks like a printer fault.
Task: Print the check character for the code.
Input
A single line holding between 1 and 1000 characters, all lowercase letters, with no spaces.
Output
One line holding the earliest character that appears exactly once in the whole code. If every character in the code appears more than once, print None — that word, with a capital N, not an empty line.
Example:
Input:
swiss
Output:
w
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in