Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <algorithm>
- #include <string>
- using namespace std;
- bool cmp(const string& a, const string& b) {
- return lexicographical_compare(a.begin(), a.end(), b.begin(), b.end());
- }
- int main() {
- string arr[10] = { "bnenhMxiK", "eaQrds", "fRNwNn", "inOCWEZHxy", "jA", "kyRNTE", "PIZRMOu", "XtueKFM", "yA", "zlkOe" };
- sort(arr, arr + 10, cmp);
- for (int i = 0; i < 10; ++i) {
- puts(arr[i].data());
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement