first_unique_char(s) that returns the first character in string s that occurs exactly once, using a dict to count occurrences in one pass and a second pass to find the first singleton. Return None if no character is unique.first_unique_char('swiss')'w'
s appears 3 times, w and i once; w comes first.
first_unique_char('aabb')None
Every character repeats.
Build counts with a dict, then iterate s in order and return the first char whose count is 1.