Description
Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1. The string consists of only lowercase English letters.
Examples
Input:
s = "leetcode"Output:
0Explanation:
'l' is first unique.
Input:
s = "abcabc"Output:
-1Explanation:
All characters appear exactly twice, so there are no unique characters. Return -1.
Input:
s = "programming"Output:
1Explanation:
'r' at index 1 is the first character that appears only once in the string.
Constraints
- •
1 ≤ s.length ≤ 10⁵