For this Question: Given a string s, find the first non-repeating character in the string and return its index. If it does not exist, return -1.First line of the input contains the string s.

<b>Constraints</b>
1<= s. length <= 100000Print the index of the first non- repeating character in a stringInput 
s = "newtonschool"

Output
1

Explanation 
"e" is the first non- repeating character in a string, I have written this Solution Code: from collections import defaultdict
s=input()
d=defaultdict(int)
for i in s:
  d[i]+=1
ans=-1
for i in range(len(s)):
  if(d[s[i]]==1):
    ans=i
    break
print(ans), In this Programming Language: Python, Now tell me if this Code is compilable or not?