First unique character
Write first_unique(text) that returns the index of the first character that appears
exactly once in text, or -1 if there is none.
first_unique("leetcode") -> 0
first_unique("loveleetcode") -> 2
first_unique("aabb") -> -1
The point is to practise two passes over the same data: count, then scan.
def first_unique(text):
...