/* * set-01.cc Standard Library, std:.set, exercise 1. */ #include #include #include #include #include using namespace std; bool read_word(istream& is, string& word) { bool found_word{ false }; char c; while (is.get(c)) { if (isalpha(c)) { word = tolower(c); // also clears old content of word found_word = true; break; } } while (isalpha(is.peek())) { word += tolower(is.get()); } return found_word; } int main() { set list; string word; while (read_word(cin, word)) { list.insert(word); } copy(begin(list), end(list), ostream_iterator(cout, "\n")); return 0; }