-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSearchingQuickly.cpp
More file actions
41 lines (38 loc) · 980 Bytes
/
SearchingQuickly.cpp
File metadata and controls
41 lines (38 loc) · 980 Bytes
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
32
33
34
35
36
37
38
39
40
41
#include <iostream>
#include <algorithm>
#include <sstream>
#include <queue>
#include <map>
#include <set>
using namespace std;
int main(){
string str, line, copy;
map<string,vector<string>> map;
set<string> ignore;
int position = 0;
while (true)
{
cin >> str;
if(str == "::")
break;
ignore.insert(str);
}
while (!cin.eof())
{
std::getline(cin, line);
transform(line.begin(), line.end(), line.begin(), ::tolower);
std::istringstream iss(line);
position = 0;
while (iss >> str) {
if(ignore.find(str) == ignore.end()){
copy = line;
transform(©[position], ©[position+str.size()], ©[position], ::toupper);
map[str].push_back(copy);
}
position+= str.size()+1;
}
}
for (auto m: map)
for(auto t: m.second)
cout << t << endl;
}