-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathcin.ignore().cpp
More file actions
38 lines (34 loc) · 769 Bytes
/
Copy pathcin.ignore().cpp
File metadata and controls
38 lines (34 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
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define F first
#define S second
#define P pair<int,int>
#define pb push_back
const int N = 100005;
int32_t main()
{
ios_base:: sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int t; cin >> t; while (t--)
{
int i, j, k, n, m, ans = 0, cnt = 0;
cin >> n;
char s[n];
map<char, int> mp;
for (i = 0; i < n; i++) {
cin >> s[i];
mp[s[i]]++;
}
string t;
cin.ignore(256, '\n');
getline(cin, t);
// cout << t << '\n';
m = t.size();
for (i = 0; i < m; i++) {
if (mp[t[i]]) ans++;
}
cout << ans << '\n';
}
}