| Task: | DNA sequence |
| Sender: | rafaykh |
| Submission time: | 2016-10-25 19:26:31 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | ACCEPTED |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.65 s | details |
Compiler report
input/code.cpp: In function 'void hashstring(std::string)':
input/code.cpp:13:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 1; (i<=subS.length()) && (i<=10); ++i){
^
input/code.cpp:14:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int j=0; j<subS.length()-i; ++j){
^Code
#include <iostream>
#include <map>
#include <string>
using namespace std;
map<string, bool> DNAMap;
//hash method
void hashstring(string subS){
string A;
for (int i = 1; (i<=subS.length()) && (i<=10); ++i){
for(int j=0; j<subS.length()-i; ++j){
A = subS.substr(j,i);
DNAMap[A]=true;
}
}
}
int main(int argc, char const *argv[])
{
int n;
string DNA, subStrin;
while(cin>>DNA){
hashstring(DNA);
cin>>n;
while(n>=1){
n--;
cin>>subStrin;
if(DNAMap.find(subStrin)==DNAMap.end())
cout<<"NO"<<endl;
else
cout<<"YES"<<endl;
}
}
}