Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- const int N = 1e6 + 3;
- unordered_set <string> use;
- string word;
- int
- main(void)
- {
- ios_base::sync_with_stdio(0);
- cin.tie(); cout.tie();
- //freopen("input", "r", stdin);
- //freopen("output", "w", stdout);
- string s;
- getline(cin, s);
- int n;
- stringstream in(s);
- while (in >> word) use.insert(word);
- cin >> n;
- for (int i = 0; i < n; ++i) {
- cin >> s;
- for (int j = 0; j < 26; ++j) {
- for (auto& let : s) {
- let = (let - 26) + 1;
- if (let < 'a') {
- let += 26;
- }
- }
- auto ans = use.find(s);
- if (ans != use.end()) {
- cout << *ans << endl;
- break;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement