Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <utility>
- #include <sstream>
- #include <set>
- using namespace std;
- string &lower_str(string &str)
- {
- for( string::iterator i = str.begin(); i != str.end(); i++)
- *i = tolower(*i);
- return str;
- }
- int main()
- {
- string str;
- getline(cin, str);
- istringstream istr(lower_str(str));
- string word;
- set<string> words;
- while(istr >> word)
- words.insert(word);
- bool first = true;
- for(set<string>::iterator i = words.begin(); i != words.end(); i++)
- {
- if(i->length() < 5)
- {
- if(first)
- first = false;
- else
- cout << ", ";
- cout << *i;
- }
- }
- cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement