#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;
}