
输入样例:
4
13005711862 13588625832
13505711862 13088625832
13588625832 18087925832
15005713862 13588625832
输出样例:
13588625832 3
代码:
#include<iostream>
#include<map>
using namespace std;
map<string,int>mp;
string ansstr;
int ansd,anscont;
int main(){
int n; cin>>n;
for(int i=0;i<n;i++){
string str1,str2; cin>>str1>>str2;
mp[str1]++; mp[str2]++;
}
for(auto it=mp.begin();it!=mp.end();it++){
if(it->second==ansd) anscont++;
if(it->second>ansd){
ansstr=it->first; ansd=it->second; anscont=1;
}
}
cout<<ansstr;
printf(" %d ",ansd);
if(anscont>1) printf("%d",anscont);
return 0;
}