#include <iostream>
#include <string>
#include <set>
#include <type_traits>
using namespace std;
bool lexical_compare(int a, int b) {
return to_string(a) < to_string(b);
}
using LexicalCompare = std::integral_constant<decltype(&lexical_compare), &lexical_compare>;
int main() {
set<int, LexicalCompare> s;
s.insert(1);
s.insert(10);
s.insert(11);
s.insert(100);
for (int x : s)
cout << x << ' ';
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8c2V0PgojaW5jbHVkZSA8dHlwZV90cmFpdHM+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpib29sIGxleGljYWxfY29tcGFyZShpbnQgYSwgaW50IGIpIHsKCXJldHVybiB0b19zdHJpbmcoYSkgPCB0b19zdHJpbmcoYik7Cn0KCnVzaW5nIExleGljYWxDb21wYXJlID0gc3RkOjppbnRlZ3JhbF9jb25zdGFudDxkZWNsdHlwZSgmbGV4aWNhbF9jb21wYXJlKSwgJmxleGljYWxfY29tcGFyZT47CgppbnQgbWFpbigpIHsKICAgIHNldDxpbnQsIExleGljYWxDb21wYXJlPiBzOwogCiAgICBzLmluc2VydCgxKTsKICAgIHMuaW5zZXJ0KDEwKTsKICAgIHMuaW5zZXJ0KDExKTsKICAgIHMuaW5zZXJ0KDEwMCk7CiAKICAgIGZvciAoaW50IHggOiBzKQogICAgICAgIGNvdXQgPDwgeCA8PCAnICc7CiAKICAgIHJldHVybiAwOwp9