| 记录编号 | 
        41629 | 
        评测结果 | 
        AAAAAAAAAA | 
    
    
        | 题目名称 | 
        898.[咲 -Saki-] 天才麻将少女什么编 | 
        最终得分 | 
        100 | 
            
    
    
        | 用户昵称 | 
         王者自由 | 
        是否通过 | 
        通过 | 
    
    
        | 代码语言 | 
        C++ | 
        运行时间 | 
        0.100 s  | 
    
    
        | 提交时间 | 
        2012-08-05 16:20:45 | 
        内存使用 | 
        0.32 MiB  | 
        
    
    
    
    		显示代码纯文本
		
		#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <map>
using namespace std;
const int N = 1000 + 10, S = 100 * 3;
int n, k, j, s, d, c[N];
map<string, int> a, m;
map<string, int>::iterator t;
char As[S], Bs[S], r[S];
string A, B, h[N];
int main() {
    freopen("sakinani.in", "r", stdin);
    freopen("sakinani.out", "w", stdout);
    scanf("%d\n", &n);
    for(int i=0; i<n; i++) {
        scanf("%s %s\n", As, Bs);
        A = As;
        B = Bs;
        if((t = a.find(B)) == a.end()) {
            a[B] = a[A] = ++d;
            h[d] = B;
        } else
            a[A] = t->second;
        //fprintf(stderr, "%s %s %d\n", A.c_str(), B.c_str(), d);
    }
    scanf("%d\n", &k);
    for(int i=0; i<k; i++) {
        scanf("%s\n", As);
        A = As;
        m[A] = 1;
    }
    while(scanf("%s\n", As) == 1) {
        A = As;
        t = a.find(A);
        if(t == a.end())
            continue;
        c[t->second]++;
        if(m.find(A) != m.end())
            c[t->second]++;
    }
    for(int i=1; i<=d; i++) {
        if(c[i] > s)
            s = c[i], j = i;
        //fprintf(stderr, "%s %d\n", h[i].c_str(), c[i]);
    }
    printf("%s\n", h[j].c_str());
    return 0;
}