#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(a) (a).begin(),(a).end()
#define rep(i, n) for(int i = 0; i < (n); i++)
signed main(){
	map<char, char> mp;
	mp['a'] = '2';
	mp['b'] = '2';
	mp['c'] = '2';
	mp['d'] = '3';
	mp['e'] = '3';
	mp['f'] = '3';
	mp['g'] = '4';
	mp['h'] = '4';
	mp['i'] = '4';
	mp['j'] = '5';
	mp['k'] = '5';
	mp['l'] = '5';
	mp['m'] = '6';
	mp['n'] = '6';
	mp['o'] = '6';
	mp['p'] = '7';
	mp['q'] = '7';
	mp['r'] = '7';
	mp['s'] = '7';
	mp['t'] = '8';
	mp['u'] = '8';
	mp['v'] = '8';
	mp['w'] = '9';
	mp['x'] = '9';
	mp['y'] = '9';
	mp['z'] = '9';
	int n;
	cin >> n;
	vector<string>t(n);
	rep(i,n){
		string str;
		cin >> str;
		string X = "";
		for(char c:str){
			X += mp[c];
		}
		t[i] = X;
	}	
	string k;
	cin >> k;
	int ans = 0;
	int S = k.size();
	sort(k.begin(), k.end());
	rep(i, n){
		string q = t[i];
		sort(q.begin(), q.end());
		if(k == q){
			ans++;
		}
	}
	cout << ans;
	return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |