Pretty Straightforward || Using max heap
Intuition\n Describe your first thoughts on how to solve this problem. \nStore the frequency of each character in the map. Push them into the heap pair  wise {c
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nStore the frequency of each character in the map. Push them into the heap pair  wise {char,freq}.\n# Approach\n<!-- Describe your approach to solving the problem. -->\nPop the elements and take care of their freq . if(freq>limit) then you have to check the next element also else just keep poping the elements.As we want the lexicographically largest string so we\'ll use second max character only one time if(freq>limit).\nHope that helps !!\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(nlogn)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(n)\n# Code\n```\n\nclass Solution {\npublic:\n    string repeatLimitedString(string s, int repeatLimit) {\n        string ans="";\n        unordered_map<char,int>mp;\n        for(auto it:s) mp[it]++;\n        priority_queue<pair<char,int>>q;\n        for(auto it:mp){\n            q.push({it.first,it.second});\n        }\n\n        while(!q.empty()){\n            auto it=q.top();\n            char ch=it.first;\n            int freq=it.second;\n            q.pop();\n            \n            if(freq>repeatLimit){\n                int cnt=repeatLimit;\n                while(cnt--){\n                    ans+=ch;\n                }\n                freq=freq-repeatLimit;\n\n            if(q.size()<=0) break;\n            auto itr=q.top();\n            char ch1=itr.first;\n            int freq1=itr.second;\n            q.pop();\n\n            if(freq1>=1){\n                ans+=ch1;\n                freq1--;\n                if(freq1>0) q.push({ch1,freq1});\n            }\n    \n            if(freq>0){\n               q.push({ch,freq});   \n              }\n            }\n\n            else{\n                while(freq--){\n                    ans+=ch;\n                }\n            }\n           \n        }\n        return ans;\n    }\n};\n```
['Greedy', 'Heap (Priority Queue)', 'C++']