Created
November 5, 2019 16:13
-
-
Save WindAzure/9a76cfa13812a37735127c9b765a220f to your computer and use it in GitHub Desktop.
UVa 10815
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <iostream> | |
#include <iterator> | |
#include <regex> | |
#include <set> | |
#include <stdio.h> | |
#include <string> | |
using namespace std; | |
int main() | |
{ | |
auto dictionary = set<string> {}; | |
auto pattern = regex("[a-zA-Z]+"); | |
string lineInArticle; | |
while (getline(cin, lineInArticle)) | |
{ | |
transform(lineInArticle.begin(), lineInArticle.end(), lineInArticle.begin(), [](const char character) { return tolower(character); }); | |
copy(sregex_token_iterator(lineInArticle.begin(), lineInArticle.end(), pattern), sregex_token_iterator(), | |
inserter(dictionary, dictionary.begin())); | |
} | |
for (const auto &words: dictionary) | |
{ | |
cout << words << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment