Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sortline.cpp
Go to the documentation of this file.
1#include <iostream>
2#include <fstream>
3#include <string>
4#include <set>
5
6typedef std::set<std::string> StrSet;
7
8int main()
9{
10 StrSet ss;
11 std::string line;
12 while (std::getline(std::cin, line)) {
13 if (!line.empty() && line[line.size() - 1] == '\n') {
14 line.resize(line.size() - 1);
15 }
16 if (!line.empty()) {
17 ss.insert(line);
18 }
19 }
20 for (StrSet::const_iterator i = ss.begin(), ie = ss.end(); i != ie; ++i) {
21 std::cout << *i << std::endl;
22 }
23}
std::set< std::string > StrSet
Definition sortline.cpp:6
int main()
Definition sortline.cpp:8