You are viewing a single comment's thread. Return to all comments →
using namespace std;
int main(){ int n; cin >> n; vector unsorted(n); for(int unsorted_i = 0; unsorted_i < n; unsorted_i++){ cin >> unsorted[unsorted_i]; }
sort(unsorted.begin(), unsorted.end(), [](const string& a, const string& b) { if (a.length() != b.length()) { return a.length() < b.length(); } return a < b; }); for (auto x:unsorted) cout << x << endl; return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Big Sorting
You are viewing a single comment's thread. Return to all comments →
include
using namespace std;
int main(){ int n; cin >> n; vector unsorted(n); for(int unsorted_i = 0; unsorted_i < n; unsorted_i++){ cin >> unsorted[unsorted_i]; }
}