map<char,int> m
for(auto itr:m) {
m[itr->first]–;
if(m[itr->first]==0)
m.erase(itr->first);
}
the map contains {<‘a’,3> ans <‘b’,1>} as element.
when i run this program the loop runs 3 times but when i dont erase elemt from map it runs 2 time can anyone explain me this behaviour?