0.2 Non Repeating Character
(RankList for this Question)
Write a function that takes in a string in lower case characters and returns the index of the strings first non-repeating character
The first non-repeating character is the first character that appears in the string only once
If the string does not have any non-repeating character print -1
Constraints
All the characters are lowercase
Length of string can be at most 100
Input Format
Output Format
Index of nonrepeating character
Example 1
Input:
”abcdcaf”
Output:
1
Explanation:
b is the first non-repeating character
Log In to solve the Question