#include #define ll long long #define pb push_back #define mp make_pair #define mod 1000000007 #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define F first #define S second #define pii pair #define afor(i,a,b) for(int i=a;i=b;--i) #define print(A,j,k) for(int ii=j;ii>t;while(t--) //ans = a ? b : c; // to simplify: if (a) ans = b; else ans = c; //if(x&1)-->odd else even. //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); using namespace std; map < string , ll > m; string s[100],str; int main() { ll n,r=0; char c; afor(i,0,26) { cin>>c>>s[i]; } cin>>n; while(n--) { cin>>str; ll z=str.length(); string ans=""; afor(i,0,z) { ans+=s[str[i]-97]; } m[ans]++; r=max(r,m[ans]); } cout<