#include<bits/stdc++.h>
using namespace std;
int main()
{
map<string,int>mp;
int count=0;
string min_num1="20000000";
string min_num2="20000000";
string s1;
string ans1,ans2;
int n;
cin>>n;
string s,str1;
for(int i=0;i<n;i++)
{
cin>>s;
mp[s]=1;
}
int m;
cin>>m;
for(int i=0;i<m;i++)
{
cin>>s;
if(mp[s]==1)
{
count++;
str1=s.substr(6,8);
if(str1<min_num1)
{
min_num1=str1;
ans1=s;
}
}
else
{
str1=s.substr(6,8);
if(str1<min_num2)
{
min_num2=str1;
ans2=s;
}
}
}
cout<<count<<endl;
if(count>0)
{
cout<<ans1<<endl;
}
else
{
cout<<ans2<<endl;
}
}
1100 校庆
最新推荐文章于 2024-08-25 23:11:21 发布