#C277. First Non-Repeating Character

    ID: 46122 Type: Default 1000ms 256MiB

First Non-Repeating Character

First Non-Repeating Character

Given a string S, your task is to find the index of the first character that does not repeat in the string. If every character appears more than once, or if the string is empty, output -1. The index starts at 0.

For example, in the string loveleetcode, the first non-repeating character is 'v' at index 2.

The solution should be efficient in terms of time complexity.

inputFormat

The input consists of a single line containing the string S.

outputFormat

Output a single integer representing the index of the first non-repeating character. If every character repeats or the string is empty, output -1.

## sample
aabbcc
-1