c++ using map
Anyone that figures out how to use iterators and delete any element that has 0 frequency in the map after loops, please post below. I would be very grateful! I 
Anyone that figures out how to use iterators and delete any element that has 0 frequency in the map after loops, please post below. I would be very grateful! I tried to mess with iterator and reverse iterator but I seem not to be able to comprehend how it works, especially in deleting key in the map (for this problem to work out specifically)\n\n```\n//Runtime: 56 ms, faster than 20.47% of C++ online submissions for Increasing Decreasing String.\n//Memory Usage: 8.1 MB, less than 24.70% of C++ online submissions for Increasing Decreasing String.\nclass Solution {\npublic:\n    string sortString(string s) {\n        string res;\n        map<char , int> m;\n        for (int i =0; i < s.size(); i++){\n            m[s[i]] += 1;\n        }\n        int n = s.size();\n        int size = res.size();\n        while(size!=n){\n             for (map<char, int>::iterator itr = m.begin(); itr != m.end();itr++ ){\n                if (itr->second != 0){\n                    itr->second = itr->second - 1;\n                    res.push_back(itr->first);\n                    ++size;  \n                }\n            }\n            //------\n            for (map<char, int>::reverse_iterator it = m.rbegin(); it != m.rend();  it++){\n                if (it->second != 0){\n                    it->second = it->second - 1;\n                    res.push_back(it->first);\n                    ++size;\n                }\n            }\n        }   \n        return res;\n    }\n};\n```
['C', 'C++']