Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <iostream>
- #include <string>
- #include <vector>
- using namespace std;
- int main() {
- int qword = 0;
- std::vector<string>word;
- cin >> qword;
- for (int i = 0; i < qword; ++i) {
- string words;
- cin >> words;
- word.push_back(words);
- }
- std::sort(word.begin(), word.end(), [](string& c1, string& c2) {
- return lexicographical_compare(
- c1.begin(), c1.end(),
- c2.begin(), c2.end(),
- [](char w, char w2) {
- return tolower(w) < tolower(w2);
- });
- });
- for (const auto& l : word) {
- std::cout << l << " ";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement