View Code of Problem 443

#include <iostream>
#include <string>
#include <cmath>		
#include <algorithm>
#include <stack>
#include <vector>
#include <set>
#include <queue>
using namespace std;

int main()
{
	int i, j, flag, k;
	int n, m, t;
	string str;
	string s1, s2;
	string ss[100];
	cin >> n;
	for (i = 0; i < n; ++i)
		cin >> ss[i];
	cin >> t;
	while(t--)
	{
		cin >> m;
		k = 0;
		while (m--)
		{
			cin >> str;
			int pos = find(ss,ss+n,str)-ss;
			if (pos>=0&&pos<n)
				k++;
		}
		cout << k << endl;
	}
	return 0;
}


Double click to view unformatted code.


Back to problem 443