Spotify wants a small utility to quickly analyze short text tokens. Write a Python function that returns the index of the first character in a string that appears exactly once.
Implement a function first_unique_char(s) where:
s containing lowercase English letters-1 if every character appears more than onceExample 1
s = "leetcode"0'l' appears once and is the first such character.Example 2
s = "loveleetcode"2'v' is the first character whose frequency is 1.Example 3
s = "aabb"-11 <= len(s) <= 10^5s contains only lowercase English lettersA clean solution should avoid comparing every character with every other character. Aim for a linear-time approach using a frequency count, then scan the string again to find the first index whose count is 1.