fork download
  1. #include <algorithm>
  2. #include <iostream>
  3. #include <vector>
  4.  
  5. int main() {
  6. std::vector<std::string> Vec = {
  7. "Мама",
  8. "Мама мыла раму",
  9. "Мама мыла"
  10. };
  11. std::sort(Vec.begin(),Vec.end(),[](const std::string& a,const std::string& b) {
  12. return a.size()<b.size();
  13. });
  14. for(const auto &i:Vec) std::cout << i << std::endl;
  15. return 0;
  16. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
Мама
Мама мыла
Мама мыла раму