In a lucky draw, the first participant whose name initial is not shared with anyone else wins.
Given a string of initials, find the index (0-based) of the first character that appears exactly once. If none exists, print -1.
Input Format
A single string of lowercase letters.
Output Format
Print the index of the first non-repeating character, or -1.
Constraints
• 1 ≤ length ≤ 10^5
Examples
Example 1
Explanation l appears only once and comes first, so index 0.
Example 2
Input
loveleetcode
Output
2
Explanation v at index 2 is the first unique character.
Example 3
Explanation Every character repeats.
Acceptance
—
Accepted
0
Submissions
0