| Task: | DNA sequence |
| Sender: | Oispa Kaljaa |
| Submission time: | 2016-05-28 11:11:03 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | ACCEPTED |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.27 s | details |
Code
#include <bits/stdc++.h>
using namespace std;
unordered_set<string> a;
int main(){
cin.sync_with_stdio(0);
cin.tie(0);
string s; cin >> s;
int n = s.length(), q;
for(int i = 1; i <= 10; i++){
for(int j = 0; j + i - 1 < n; j++)
a.insert(s.substr(j, i));
}
cin >> q;
while(q--){
string qs; cin >> qs;
if(a.count(qs))
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
