32. First Unique Character
EasyStringHash Map
Print the index of the first character that appears exactly once in the string, or -1 if there is none.
Input format
A single string of lowercase letters.
Output format
An index or -1.
Example 1
Input
leetcode
Output
0
Example 2
Input
loveleetcode
Output
2
Constraints
1 ≤ length ≤ 10⁵
Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.
Loading the MyLoginn IDE…