-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ008.cpp
More file actions
42 lines (33 loc) · 769 Bytes
/
Copy pathQ008.cpp
File metadata and controls
42 lines (33 loc) · 769 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
// 2021-06-16
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n;
string t;
cin >> n >> t;
vector<string> s;
while(n--){
string tmp;
cin >> tmp;
s.push_back(tmp);
}
sort(t.begin(), t.end());
t.erase(unique(t.begin(), t.end()), t.end());
for(int i=0;i<s.size();i++){
sort(s[i].begin(), s[i].end());
s[i].erase(unique(s[i].begin(), s[i].end()), s[i].end());
int cnt = 0;
for(int j=0;j<s[i].size();j++){
if (s[i][j] == t[j]) {
cnt++;
}
}
if (cnt==t.size()){
cout << "Yes\n";
} else {
cout << "No\n";
}
}
}