blob: b85944183a1570d7fc11c4a4fe89aebbff51d936 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#include <iostream>
#include <sstream>
#include <string>
#include <set>
#include <algorithm>
int main()
{
std::string line, word;
std::set<std::string> words;
getline(std::cin, line);
std::istringstream lineStream(line);
while(lineStream >> word)
if(word.size() < 5)
{
transform(word.begin(), word.end(), word.begin(),[](unsigned char c){ return tolower(c); });
words.insert(word);
}
if (words.size() > 0)
{
for (std::set<std::string>::iterator it = words.begin(); it != --words.end(); ++it)
{
std::cout << *it << ", ";
}
}
std::cout << *(--words.end());
return 0;
}
|