View Code of Problem 443

#include<iostream>
using namespace std;
int main(){
	int n;cin>>n;
	string s[n];
	for(int i=0;i<n;++i)cin>>s[i];
	int k;cin>>k;
	while(k--){
		int x;cin>>x;
		string str;
	
		int ans=0;
		for(int i=0;i<x;++i){
			cin>>str;
			for(int j=0;j<n;++j){
				if(str==s[j])++ans;
			}
		}
		cout<<ans<<endl;
	}
}

Double click to view unformatted code.


Back to problem 443