Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <algorithm>
- #include <vector>
- #include <string>
- void print(const std::string& item)
- {
- printf("%s\n", item.c_str());
- }
- int main()
- {
- std::vector<std::string> sortedItems;
- std::string name;
- while(std::cin >> name)
- sortedItems.push_back(name);
- std::sort(sortedItems.begin(), sortedItems.end());
- std::for_each(sortedItems.begin(), sortedItems.end(), &print);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement