#include <iostream>
#include <string>
using namespace std;
int main( )
{
string nowword, beforeword, result;
int count, maxCount;
cin>>nowword;
result = beforeword = nowword;
count = maxCount = 1;
while(cin>>nowword)
{
if(nowword == "quit")
break;
if(nowword == beforeword)
count++;
else
{
beforeword = nowword;
count = 1;
}
if(count > maxCount)
{
result = nowword;
maxCount = count;
}
}
cout<<maxCount<<result;
return 0;
}
#include <string>
using namespace std;
int main( )
{
string nowword, beforeword, result;
int count, maxCount;
cin>>nowword;
result = beforeword = nowword;
count = maxCount = 1;
while(cin>>nowword)
{
if(nowword == "quit")
break;
if(nowword == beforeword)
count++;
else
{
beforeword = nowword;
count = 1;
}
if(count > maxCount)
{
result = nowword;
maxCount = count;
}
}
cout<<maxCount<<result;
return 0;
}