16: First unique character

Given a lowercase string, find an index of first unique character. If there's no unique character return -1

 

Example 1

Input: code

Output: 0

Explanation: c is the first unique character

Example 2

Input: success

Output: 1