fork download
  1. #include <iostream>
  2. #include <set>
  3. #include <string>
  4. #include <algorithm>
  5.  
  6. struct less
  7. {
  8. bool operator()(const std::string & l, const std::string & r) const
  9. {
  10. return l.size() < r.size();
  11. }
  12. };
  13.  
  14. int main()
  15. {
  16. std::set<std::string, less> you{ "нахуй", "иди", ", пидор" };
  17.  
  18. std::for_each(you.cbegin(), you.cend(), [](const std::string & s) {std::cout << s << " "; });
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 3464KB
stdin
Standard input is empty
stdout
иди нахуй , пидор