Task: | DNA sequence |
Sender: | Barely Div 1 |
Submission time: | 2016-05-28 11:13:33 +0300 |
Language: | C++ |
Status: | READY |
Result: | ACCEPTED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.67 s | details |
Code
#include <iostream> #include <string> #include <set> using namespace std; int main(){ string s; cin >> s; int n = s.size(); int nQueries; cin >> nQueries; set<string> db; for(int L = 1; L <= 10; L++){ for(int i = 0; i < n; i++){ db.insert(s.substr(i,L)); } } for(int i = 0; i < nQueries; i++){ string query; cin >> query; if(db.count(query)) cout << "YES\n"; else cout << "NO\n"; } }