class Solution { public: int FirstNotRepeatingChar(string str) { if(str=="")return -1; vector<int> a(256,0); for(int i=0;i<str.size();i++) a[str[i]]++; for(int i=0;i<str.size();i++) if(a[str[i]]==1) return i; return -1; } };