#K56832. Find the First Non-Repeating Character

    ID: 30286 Type: Default 1000ms 256MiB

Find the First Non-Repeating Character

Find the First Non-Repeating Character

Given a string, find the index of the first character that does not repeat. In other words, if a character appears only once in the string, return its index; otherwise, return -1 if no such character exists.

For example, in the string leetcode\texttt{leetcode}, the first non-repeating character is 'l' at index 0. Your program must read the input from stdin and output the result to stdout.

inputFormat

A single line input containing a string ss. The string may contain uppercase and lowercase letters. Treat all characters (including spaces) as relevant.

outputFormat

Output a single integer which is the index of the first non-repeating character. If no such character exists, output -1.## sample

leetcode
0