Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- char s[200] , s1[200] , x[200] , x1[200] , s3[200];
- int tes;
- while(cin >> tes)
- {
- if(tes == 0)
- break;
- map < string , string> ms;
- vector <string> vs , vc;
- for(int i = 0; i < tes; i++)
- {
- cin >> s >> s1;
- ms[s] = s1;
- }
- int p , t;
- cin >> p;
- t = p;
- while(p--)
- {
- cin >> x >> x1;
- vs.push_back(ms[x]);
- vc.push_back(x1);
- }
- int ck = 0;
- for(int i = 0; i < vs.size(); i++)
- {
- int c = 0;
- for(int j = 0; j < vs[i].size(); j++)
- {
- if(vs[i][j] == vc[i][j])
- c++;
- }
- if(c + 1 == vs[i].size() || c == vs[i].size())
- ck++;
- }
- printf("%d\n",t - ck);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement