Given a string s, return the index of the first character that appears exactly once in it.
If every character repeats, return -1.
Examples
Example 1
- Input
- s = "swiss"
- Output
- 1
- Why
- 'w' is the first character that appears only once.
Example 2
- Input
- s = "aabb"
- Output
- -1
Example 3
- Input
- s = "codeshare"
- Output
- 0
Constraints
1 <= s.length <= 10^5scontains only lowercase English letters.