| 1 | // |
|---|---|
| 2 | // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) |
| 3 | // |
| 4 | // Distributed under the Boost Software License, Version 1.0. |
| 5 | // https://www.boost.org/LICENSE_1_0.txt |
| 6 | |
| 7 | #include <iostream> |
| 8 | #include <set> |
| 9 | #include <string> |
| 10 | |
| 11 | #include <boost/locale.hpp> |
| 12 | |
| 13 | using namespace boost::locale; |
| 14 | |
| 15 | int main() |
| 16 | { |
| 17 | generator gen; |
| 18 | // Set global locale |
| 19 | std::locale::global(loc: gen("")); |
| 20 | |
| 21 | // Create a set that includes all strings sorted in alphabetical order |
| 22 | // std::locale can be used as object for comparison |
| 23 | std::set<std::string, std::locale> all_strings; |
| 24 | |
| 25 | // Read all strings into the set |
| 26 | while(!std::cin.eof()) { |
| 27 | std::string tmp; |
| 28 | std::getline(is&: std::cin, str&: tmp); |
| 29 | all_strings.insert(x: tmp); |
| 30 | } |
| 31 | // Print them out |
| 32 | for(const std::string& str : all_strings) |
| 33 | std::cout << str << std::endl; |
| 34 | } |
| 35 |
