class FirstRepeat { public: char findFirstRepeat(string A, int n) { int i=0; int len=A.size(); unordered_map<char,int>hash; for(i=0;i<len;i++) { if(hash.count(A[i])==0) { hash[A[i]]=1; } else { return A[i]; break; } } return '0'; } };
class FirstRepeat { public: char findFirstRepeat(string A, int n) { int i=0; int len=A.size(); unordered_map<char,int>hash; for(i=0;i<len;i++) { if(hash.count(A[i])==0) { hash[A[i]]=1; } else { return A[i]; break; } } return '0'; } };