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 amount;
- cin>>amount;
- string s;
- vector<string> words;
- for (int i = 0; i<amount; ++i){
- cin>>s;
- words.push_back(s);
- }
- sort(words.begin(), words.end(), [] (const string& lha, const string& rha){
- return lexicographical_compare(lha.begin(), lha.end(), rha.begin(), rha.end(),
- [](const unsigned char lhs, const unsigned char rhs){
- return tolower(lhs) < tolower(rhs);
- });
- });
- for(auto& word: words){
- cout<<word<<" ";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment