class Solution { public: int firstUniqChar(string s) { map<char,int>Mp; for(int i=0;i<s.size();i++) Mp[s[i]]+=1; for(int i=0;i<s.size();i++){ if(Mp[s[i]]==1) return i; } return -1; } };