1 // 2 // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) 3 // 4 // Distributed under the Boost Software License, Version 1.0. (See 5 // accompanying file LICENSE_1_0.txt or copy at 6 // http://www.boost.org/LICENSE_1_0.txt) 7 // 8 #include <iostream> 9 #include <string> 10 #include <set> 11 12 #include <boost/locale.hpp> 13 14 using namespace std; 15 using namespace boost::locale; 16 main()17int main() 18 { 19 generator gen; 20 std::locale::global(gen("")); 21 /// Set global locale to requested 22 23 /// Create a set that includes all strings sorted according to ABC order 24 /// std::locale can be used as object for comparison 25 typedef std::set<std::string,std::locale> set_type; 26 set_type all_strings; 27 28 /// Read all strings into the set 29 while(!cin.eof()) { 30 std::string tmp; 31 getline(cin,tmp); 32 all_strings.insert(tmp); 33 } 34 /// Print them out 35 for(set_type::iterator p=all_strings.begin();p!=all_strings.end();++p) { 36 cout<<*p<<endl; 37 } 38 39 } 40 // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 41