#include <string>
#include <map>
#include <iostream>
int main()
{
auto comp = [](const std::string& a, const std::string& b) { return a.length() < b.length(); };
std::map<std::string, std::string, decltype(comp)> my_map(comp);
my_map["1"] = "a";
my_map["three"] = "b";
my_map["two"] = "c";
my_map["fouuur"] = "d";
for(auto const &kv : my_map)
std::cout << kv.first << std::endl;
return 0;
}
I2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPG1hcD4KI2luY2x1ZGUgPGlvc3RyZWFtPgogICAgIAppbnQgbWFpbigpCnsKICAgIGF1dG8gY29tcCA9IFtdKGNvbnN0IHN0ZDo6c3RyaW5nJiBhLCBjb25zdCBzdGQ6OnN0cmluZyYgYikgeyByZXR1cm4gYS5sZW5ndGgoKSA8IGIubGVuZ3RoKCk7IH07CiAgICBzdGQ6Om1hcDxzdGQ6OnN0cmluZywgc3RkOjpzdHJpbmcsIGRlY2x0eXBlKGNvbXApPiBteV9tYXAoY29tcCk7CiAgICAgCiAgICBteV9tYXBbIjEiXSAgICAgID0gImEiOwogICAgbXlfbWFwWyJ0aHJlZSJdICA9ICJiIjsKICAgIG15X21hcFsidHdvIl0gICAgPSAiYyI7CiAgICBteV9tYXBbImZvdXV1ciJdID0gImQiOwogICAgIAogICAgZm9yKGF1dG8gY29uc3QgJmt2IDogbXlfbWFwKQogICAgICAgIHN0ZDo6Y291dCA8PCBrdi5maXJzdCA8PCBzdGQ6OmVuZGw7CiAgICAgCiAgICByZXR1cm4gMDsKfQ==