Go: package main

import (
	"bufio"
	"os"
	"strings"
	"fmt"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	words := strings.Split(scanner.Text(), " ")
	wordMap := make(map[string]int)
	for _, v := range words {
		wordMap[v]++
	}
	key := ""
	value := -1
	l := -1
	word := ""
	for k, v := range wordMap {
		// fmt.Println(k, v)
		if value < v {
			key = k
			value = v
		}
		if l < len(k) {
			l = len(k)
			word = k
		}
	}

	fmt.Println(key, word)
	// fmt.Println(wordMap)
}

C++: #include <iostream>
#include <map>
#include <string>

using namespace std;

int main(void)
{
    string str;
    map<string, int> cnt;
    string freq;
    string maxlen;
    while(cin >> str) {
        int c = cnt[str]++;

        if(c > cnt[freq])
            freq = str;
        if(str.size() > maxlen.size())
            maxlen = str;
    }
    cout << freq << " " << maxlen << endl;

    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	string ans = "";
	map <string ,int> mp;
	while(cin >> s){
		if(ans.size() < s.size())
			ans = s;
		mp[s]++;
	}
	int va = 0;
	string asdf;
	for(auto itr = mp.begin() ; itr != mp.end() ; itr++)
		if((*itr).second > va)
			asdf = (*itr).first;
	cout << asdf << " " << ans << endl;
}

C++: #include<iostream>
#include<string>
#include<map>
using namespace std;
int main()
{
	string s1,s2,s3;
	char s[5000],c;
	int m1=0,m2=0;
	map<string,int>mp;
	while(c=getchar())
	{
		if(c=='\n')break;
		if(c!=' ')
		{
			s1+=c;
		}
		else
		{
			if(mp.find(s1)==mp.end())mp[s1]=1;
			else mp[s1]++;
			if(mp[s1]>m1)
			{
				m1=mp[s1];
				s2=s1;
			}
			if(s1.size()>m2)
			{
				m2=s1.size();
				s3=s1;
			}
			s1.erase();
		}
	}
	if(mp[s1]>m1)
			{
				m1=mp[s1];
				s2=s1;
			}
			if(s1.size()>m2)
			{
				m2=s1.size();
				s3=s1;
			}
			s1.erase();
	cout<<s2<<" "<<s3<<endl;
	return 0;
}

C++: #include<iostream>
#include<string>
#include<ctype.h>
using namespace std;
string a,b[1000],d;
int c[1000];
int main(){
	int top=0;
	d=" ";
	while(cin>>a){
		for(int i=0;i<a.size();i++)
			a[i]=tolower(a[i]);
		if(a.size()>=d.size())
			d=a;
		bool t=true;
		for(int i=0;i<top;i++){
			if(b[i]==a){
				t=false;
				c[i]++;
			}
		}
		if(t==true){
			b[top]=a;
			c[top]=1;
			top++;
		}
	}
	int best=0,set;
	for(int i=0;i<top;i++){
		if(c[i]>best)
			set=i;
	}
	cout<<b[set]<<" "<<d<<endl;
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<map>
#include<vector>
#include<sstream>

using namespace std;

string str;

int main(void){
	string word;
	
	map<string,int> h;
	vector<string> v;
	
	getline(cin, str);
	stringstream ss;
	ss << str;
	while(ss >> word){
		h[word]++;
		v.push_back(word);
	}
	int mh = 0, ml = 0;
	int hi = 0, li = 0;
	for(int i = 0; i < v.size(); i++){
//		cout << h[v[i]] << endl;
		if(h[v[i]] > mh){
			mh = h[v[i]];
			hi = i;
		}
		if(v[i].size() > ml){
			ml = v[i].size();
			li = i;
		}
	}
	
	cout << v[hi] << " " << v[li] << endl;
	
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<map>
using namespace std;
string str,ans="",ans2="";
map < string,int > tab;
int main(){
  while(cin>>str){
    if(str.size()>ans2.size())ans2=str;
    tab[str]++;
    if(tab[ans]<tab[str])ans=str;
  }
  cout<<ans<<' '<<ans2<<endl;
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	string ans = "";
	map <string ,int> mp;
	while(cin >> s){
		transform(s.begin(), s.end() ,s.begin() ,::toupper);
		if(ans.size() < s.size())
			ans = s;
		mp[s]++;
	}
	int va = 0;
	string asdf;
	for(auto itr = mp.begin() ; itr != mp.end() ; itr++)
		if((*itr).second > va)
			asdf = (*itr).first;
	cout << asdf << " " << ans << endl;
}

C++: #include<iostream>
#include<map>
using namespace std;

int main(void){
  map<string,int>m;
  map<string,int>::iterator it,cit,sit;
  string s;
  int maxS=0,maxC=0;
  while(cin >>s){
    m[s]+=1;
  }
  for(it=m.begin();it!=m.end();it++){
    int size=(*it).first.size();
    if(size>maxS){
      sit=it;
      maxS=size;
    }
    int cou=(*it).second;
    if(cou>maxC){
      cit=it;
      maxC=cou;
    }
  }
  
 for(it=m.begin();it!=m.end();it++){
   cout <<(*it).first.size() <<" "<<(*it).second<<endl;
  }
  
  cout <<(*cit).first <<" "<<(*sit).first<<endl;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
    long saidai=0;
    char f;
    int a=0,cnt=0,num=0,max=0,t;
    string str,tango[1000]={""},answer,ans;
    getline(cin,str);
    for(int i=0;i<str.size();i++){
        if(str[i]==' '){
            for(int j=a;j<i;j++){
                if(isupper(str[a])){
                    f=str[a];
                    f=f+32;
                    str[a]=f;
                }
                tango[cnt]+=str[j];
            }
            cnt=cnt+1;
            a=i+1;
        }
    }
    for(int p=a;p<str.size();p++){
        tango[cnt]+=str[p];
    }
    
    
    
    for(int k=0;k<=cnt;k++){
        if(saidai<tango[k].size()){
            saidai=tango[k].size();
            ans=tango[k];
        }
    }
    
    for(int s=0;s<cnt;s++){
        for(t=s+1;t<=cnt;t++){
            if(tango[s]==tango[t]){
                num=num+1;
            }
        }
        if(max<num){
            max=num;
            answer=tango[t];
        }
    }
    cout<<answer<<" "<<ans<<endl;
    return 0;
}

C++: #include<iostream>
#include<map>
using namespace std;
string a,b,s;
int A,B;
map<string,int>M;
int main(){
  while(cin>>s){
    if(A<s.size()) A=s.size(),a=s;
    if(B<++M[s])B=M[s],b=s;
  }
  cout<<b<<" "<<a<<endl;
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<map>
using namespace std;
int main(){
  map<string,int> t;
  string s, mxc, mxl;
  int freq, len;
  while(cin >> s){
    if(t.find(s) == t.end()){
      t[s] = 1;
    }
    else{
      t[s]++;
    }

    if(t[s] > freq){
      freq = t[s];
      mxc = s;
    }
    if(s.size() > len){
      len = s.size();
      mxl = s;
    }
  }
  cout << mxc << " " << mxl << endl;
}

C++: #include <iostream>
#include <string>
#include <map>

int main(){
    std::string inp;
    std::map<std::string, int> occ;
    std::string maxLen, maxOcc;
    while(std::cin >> inp){
        (occ[inp])++;
        if(occ[maxOcc] < occ[inp])
            maxOcc = inp;
        if(maxLen.size() < inp.size())
            maxLen = inp;
    }
    std::cout << maxOcc << ' ' << maxLen << std::endl;    
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>

using namespace std;

const int M = 33;
const int N = 3333001;

char text[N];
char word[N][M];
char tmp[N], ansm[N], ansl[N]; 

int cmp(const void *a, const void *b) {
	return strcmp((char *)a, (char *)b);
}

void solve(char text[]) {
	int len = strlen(text);
//	for (int i=0; i<len; ++i) {
//		if (text[i] >= 'A' && text[i] <= 'Z') text[i] = text[i] - 'A' + 'a';
//	}
	int j = 0, k = 0;
	for (int i=0; i<len; ++i) {//分解文章 
		if (text[i] != ' ') word[k][j++] = text[i];
		else {
			if (j == 0) continue;
			word[k++][j] = '\0', j = 0;
		}
	}
	if (j) word[k++][j] = '\0';
	qsort(word, k, sizeof(word[0]), cmp);
	int maxs = -1;
	int cnt = 1;
	strcpy(tmp, word[0]);
	strcpy(ansl, word[0]);
	int maxl = strlen(word[0]);
	for (int i=1; i<k; ++i) {
		if (maxl < strlen(word[i])) maxl = strlen(word[i]), strcpy(ansl, word[i]);
		if (!strcmp(tmp, word[i])) ++cnt;
		else {
			if (maxs < cnt) {
				maxs = cnt;
				strcpy(ansm, tmp);
			}
			strcpy(tmp, word[i]);
		}
	}
	if (maxs < cnt) strcpy(ansm, tmp);
}

int main() {
	cin.getline(text, N, '\n');
//	while (cin.getline(text, N, '\n')) {
		solve(text);
		cout<<ansm<<" "<<ansl<<endl;
//	}
	return 0;
}