#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#define INF 1e6
using namespace std;
typedef long long ll;
const ll MAXN = 1000005;
void solve()
{
map<char, int>v;
v['a'] = 2;
v['b'] = 2;
v['c'] = 2;
v['d'] = 3;
v['e'] = 3;
v['f'] = 3;
v['g'] = 4;
v['h'] = 4;
v['i'] = 4;
v['j'] = 5;
v['k'] = 5;
v['l'] = 5;
v['m'] = 6;
v['n'] = 6;
v['o'] = 6;
v['p'] = 7;
v['q'] = 7;
v['r'] = 7;
v['s'] = 7;
v['t'] = 8;
v['u'] = 8;
v['v'] = 8;
v['w'] = 9;
v['x'] = 9;
v['y'] = 9;
v['z'] = 9;
int n; cin >> n;
vector<string>s(n);
for (int i = 0; i < n; i++) cin >> s[i];
string a; cin >> a;
vector<int>vis;
for (auto u : a)vis.push_back(u - '0');
int ans = 0;
for (int i = 0; i < n; i++) {
bool flag = true;
for (int j = 0; j < s[i].size(); j++) {
if (vis[j] != v[s[i][j]]) { flag = false; break; }
}
if (flag)++ans;
}
cout << ans << "\n";
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int t = 1; //cin >> t;
while (t--) solve();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |