Why does this submission pass while this one fails ?
The only difference in the codes is that in the correct submission I inserted in the map as
m[s]=i+1;
while in the 2nd one I inserted as :
m.insert(make_pair(s,i+1));
and similarly for finding the index in the correct submission I used
B[i] = m[s];
and in the incorrect submission I used :
B[i] = m.find(s)->S;
So what is the cause of WA ? It has made me curious since quite a few days
Thanks!