#K56832. Find the First Non-Repeating Character
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 , 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 . 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