#K76252. Find the Index of the First Non-Repeating Character

    ID: 34601 Type: Default 1000ms 256MiB

Find the Index of the First Non-Repeating Character

Find the Index of the First Non-Repeating Character

Given a string \(s\) consisting of lowercase letters, determine the index \(i\) of the first character in \(s\) that does not appear anywhere else in the string. If no such character exists, return \(-1\).

For example, for the input string "leetcode", the first non-repeating character is 'l' at index 0. Similarly, for "loveleetcode", the first non-repeating character 'v' appears at index 2; and for "aabb", every character repeats so the answer is -1.

inputFormat

The input consists of a single line, which contains the string \(s\) made up of lowercase English letters. The string is read from standard input (stdin).

outputFormat

Output a single integer which is the index of the first non-repeating character of \(s\). If no non-repeating character exists, output \(-1\).

## sample
leetcode
0