First Unique Character

Medium · rating 1250 · Hashing, Strings

Read a string of lowercase letters. Print the 0-based index of the first character that appears exactly once, or -1 if there is none.

Constraints: 1 ≤ length ≤ 105

Related problems

Open First Unique Character in Code Arena →