#include<iostream>#include<string>#include<map>usingnamespace std;boolcharacterLegal(char& c){if(c <='9'&& c >='0')returntrue;if(c <='Z'&& c >='A'){
c = c +'a'-'A';returntrue;}if(c <='z'&& c >='a')returntrue;returnfalse;}intmain(){
string input;getline(cin, input);
map<string,int> m;
string word ="";for(int i =0; i < input.length(); i++){if(characterLegal(input[i])){
word = word + input[i];}else{if(word.length()>0)
m[word]= m.find(word)== m.end()?1:(m[word]+1);
word ="";}}if(word.length()>0)
m[word]= m.find(word)== m.end()?1:(m[word]+1);int max_count =0;
string result ="";for(auto itr = m.begin(); itr != m.end(); itr++){if(itr->second > max_count){
max_count = itr->second;
result = itr->first;}}
cout<<result<<" "<<max_count<<endl;}