First non-repeating character
Print the first character of the string that appears exactly once. If there is none, print -1.
Reported in: Wipro Elite NTH, Infosys (2021–25), Accenture (memory-based)
Input
One line: the string.
Output
A character, or -1.
Constraints
1 ≤ length ≤ 10^5.
Example 1
Input:
swiss
Output:
wExample 2
Input:
aabb
Output:
-1Hint: Count every character first, then scan again from the left.