Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- #include <string>
- #include <set>
- using namespace std;
- int main() {
- string line, word;
- getline(cin, line);
- istringstream ss(line);
- set<string> words;
- while (ss >> word) {
- if (word.size() < 5) {
- for (int i = 0; i < word.size(); i++) {
- word[i] = tolower(word[i]);
- }
- words.insert(word);
- }
- }
- while (!words.empty()) {
- cout << *words.begin();
- words.erase(words.begin());
- if (!words.empty()) {
- cout << ", ";
- }
- }
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement