无脑调用标准库

#include<iostream>
#include<string>
#include<algorithm>
#include<map>

inline int min(int a, int b);

int main(int argc, char const *argv[])
{
    std::string instr;
    std::map<char, int> mymap;
    int value_min = 20;//题目最大20个字符

    std::cin >> instr;

    for (auto c : instr)
    {
        mymap[c]++;
    }

    //找出最小数
    for (const auto &it : mymap)
    {
        value_min = min(it.second, value_min);
    }

    for (auto i = mymap.begin(); i != mymap.end(); i++)
    {
        if (i->second == value_min)
        {
            for (int a = 0; a < value_min; a++)
            {
                instr.erase(std::find(instr.begin(), instr.end(), i->first));
            }
            
        }
        
    }

    std::cout << instr <<std::endl;
    
    return 0;
}

inline int min(int a, int b)
{
    return a > b ? b : a;
}