Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

type Pair struct {
	key   string
	value int
}

func main() {
	scanner.Split(bufio.ScanWords)
	counts := map[string]int{}
	maxLen := 0
	maxLenWord := ""
	for {
		word := nextString()
		if word == "" {
			break
		}

		counts[word]++

		if len(word) > maxLen {
			maxLen = len(word)
			maxLenWord = word
		}
	}

	mapPairs := []Pair{}
	for k, v := range counts {
		mapPairs = append(mapPairs, Pair{k, v})
	}
	sort.Slice(mapPairs, func(i, j int) bool { return mapPairs[i].value > mapPairs[j].value })

	fmt.Println(mapPairs[0].key, maxLenWord)
}

C++: #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define pb         push_back
#define mp         make_pair
#define ll         long long
#define PI         acos(-1.0)
#define ALL(A)     ((A).begin(), (A).end())
#define vsort(v)   sort(v.begin(),v.end())
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)


int main(){
    int i, j, lmax=0, lind=0, nmax=0, nind=0, cnt=0, vsize;
    string s,vv;
    vector<string> v;
    while(cin>>s){
        if(s==EOF) break;
        v.pb(s);
    }
    for(i=0;i<int(v.size());i++){
        cnt=0;
        vv=v[i];
        for(j=0;j<int(vv.size());j++){
            if(v[i]==v[j]){
                cnt++;
            }
        }
        if(nmax<cnt){
            nmax=max(cnt,nmax);
            nind=i;
        }
        if(lmax<int(vv.size())){
            lmax=max(lmax,int(vv.size()));
            lind=i;
        }
    }
    cout << v[lind] << v[nind] << endl;
}

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

using namespace std;

const int M = 33;
const int N = 1001;

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

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

void solve(char text[]) {
	int len = strlen(text);
	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() {
	while (cin.getline(text, N, '\n')) {
		solve(text);
		cout<<ansm<<" "<<ansl<<endl;
	}
	return 0;
}

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;
}