_takumi

Sort_no_register_1

Aug 8th, 2019
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int n;
  6.     cin >> n;
  7.     string s;
  8.     vector<string> v;
  9.     while (cin >> s) {
  10.         v.push_back(s);
  11.     }
  12.     sort(begin(v), end(v), [](string s1, string s2) {
  13.         transform(s1.begin(), s1.end(), s1.begin(), ::toupper);
  14.         transform(s2.begin(), s2.end(), s2.begin(), ::toupper);
  15.         return (s1 < s2);
  16.     });
  17.     for (const string& ch : v) {
  18.         cout << ch << ' ';
  19.     }
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment