-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1507.cpp
More file actions
49 lines (30 loc) · 809 Bytes
/
1507.cpp
File metadata and controls
49 lines (30 loc) · 809 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
42
43
44
45
46
47
48
49
#include<iostream>
#include<vector>
using namespace std;
int main(){
int numCasosTeste;
cin>>numCasosTeste;
for (int i = 0; i < numCasosTeste; i++){
string sequencia,subSequencia;
int qtdConsultas;
cin>>sequencia;
cin>>qtdConsultas;
for (int j = 0; j < qtdConsultas; j++){
cin>>subSequencia;
int subSize = subSequencia.length();
int index = 0;
bool encontrou = false;
for (int seqIndex = 0; seqIndex < sequencia.length(); seqIndex++){
if(sequencia[seqIndex] == subSequencia[index]){
index++;
if(index == subSize){
cout<<"Yes\n";
encontrou = true;
break;
}
}
}
if(!encontrou) cout<<"No\n";
}
}
}