```
int Solution::anytwo(string A) {
unordered_map<char,int> mp;
int min_ind = INT_MAX; // Just store the min index of repeating char so that
//whenever new repeating char comes whose index is more than
//prev return 1;
for(int i=0 ; i<A.size() ; i++){
if(mp.count(A[i])){
if(mp[A[i]]>=min_ind){
return 1;
}
else{
min_ind = mp[A[i]];
}
}
else{
mp[A[i]] = i;
}
}
return 0;
```

}