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<vector>
#include<map>
#include<string>
using namespace std;
int main()
{
  string word,frequent,longest;
  map<string,int> table;
  size_t N=0;
  while(cin >> word){
    table[word] += 1;
    N =table[word] < N ? N : table[word];
    frequent = table[word] < N ? frequent : word;
    longest = word.size() < longest.size() ? longest : word;
  }
  cout << frequent << " " << longest << endl;
}

C++: #include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
  int c=0;
  string s,large="",max;
  map<string,int>wordbox;
  while(cin>>s){
    wordbox[s]++;
    if(s.length()>large.length())large=s;
  }
  map<string,int>::iterator it=wordbox.begin();
  while(it!=wordbox.end()){
    if((*it).second>c)max=(*it).first,c=(*it).second;
    it++;
  }
  cout<<large<<" "<<max<<endl;
  return 0;
}

C++: #include <stdio.h>
#include <string.h>

int main(void) {
  char s[40], ans[1200][40], maxm = 0, maxl = 0;
  int now = 0, i, j, k, n[1200];
  while(scanf("%s", s) != EOF) {
    int t = 1;
    for(i = 0; i < now; ++i) if(!strcmp(s, ans[i])) {
      n[i]++, t = 0;
      break;
    }
    if(t) {
      strcpy(ans[now], s);
      n[now] = 1;
      now++;
    }
  }
  for(i = 0; i < now; ++i) {
    if(maxm < n[i]) maxm = n[i];
    if(maxl < strlen(ans[i])) maxl = strlen(ans[i]);
  }
  char ansm[40], ansl[40];
  for(i = 0; i < now; ++i) {
    if(maxm == n[i]) strcpy(ansm, ans[i]);
    if(maxl == strlen(ans[i])) strcpy(ansl, ans[i]);
  }
  printf("%s %s\n", ansm, ansl);
  return 0;
}

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

int main(void){

  int max_size=0,max_cnt=0;
  string word,result_cnt,result_size;
  map<string , int> word_cnt;

  while(cin >> word){
    if(word_cnt.find(word) != word_cnt.end()){
      int tmp = word_cnt.find(word)->second;
      tmp++;
      word_cnt.insert(make_pair(word,tmp));
    }else{
      int tmp = 1;
      word_cnt.insert(make_pair(word,tmp));
    }
  }

    for (map<string,int>::iterator ite=word_cnt.begin(); ite!=word_cnt.end(); ite++){
      if(max_cnt <  ite->second){
	max_cnt = ite->second;
	result_cnt = ite->first;
      }
      string w = ite->first;
      int w_size = w.size();
      if(max_size < w_size){
	max_size = w_size;
	result_size = ite->first;
      }
    }

    cout << result_cnt << ' ' << result_size << endl;



  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef map<string,int>M;
int main(void)
{
	string s,t;
	string ss,tt;
	int nn,mm,cnt;
	int i;
	int lMAX,sMAX;
	M mp;
	getline(cin,s);
	s+=' ';
	for(i=0;i<(int)s.size();i++){
		//cout<<s[i]<<endl;
		if(s[i]==' '){
			//cout<<t<<endl;
			mp[t]++;
			t="";
		}
		else	t+=s[i];
	}
	lMAX=sMAX=-1;
	for(auto it=mp.begin();it!=mp.end();it++){
		//cout<<it->first<<" "<<it->second<<endl;
		s=it->first;
		cnt=it->second;
		if(sMAX<cnt){
			sMAX=cnt;
			ss=s;
		}
		if(lMAX<(int)s.size()){
			lMAX=(int)s.size();
			tt=s;
		}
	}
	cout<<ss<<" "<<tt<<endl; 
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
map<string,int> Map;
string str,ans="";
signed main(void){
	ios::sync_with_stdio(false);
	while(cin>>str){
		Map[str]++;
		if(str.length()>ans.length())
			ans=str;
	}
	int maxn=0;
	for(map<string,int>::iterator it=Map.begin();it!=Map.end();++it)
		maxn=max(maxn,(int)it->second);
	for(map<string,int>::iterator it=Map.begin();it!=Map.end();++it)
		if(maxn==(int)it->second){
			cout<<it->first<<" ";
			break;
		}
	cout<<ans<<endl;
}

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

int main(){
  string s[1000];
  int n=0;
  while(cin>>s[n]) n++;
  sort(s,s+n);
  int m,c;
  m=c=0;
  string t,ms,l;
  ms=t=s[0];
  for(int i=0;i<n+1;i++){
    if(t==s[i]) c++;
    else{
      if(c>m){
	m=c;
	ms=t;
      }
      c=1;
      t=s[i];
      if(t.length()>l.length()) l=t;
    }
  }
  cout<<ms<<" "<<l<<endl;
  return 0;
}

C++: #if 0
????????£????????????15m
size_t????????£?????°?¢??????????????????£?????´??°N????????????????????????
#endif

#include <iostream>
#include <string>
#include <map>
using namespace std;

map<string,int> table;
int main(){
	string word, M_frequent, longest;
	size_t N=0; //?????§???????????????????????????????????°
	while(cin>>word){
		table[word]++;
		if(table[word]>N){
			N=table[word];
			M_frequent=word;
		}
		if(word.size()>longest.size())
			longest=word;
	}
	cout<<M_frequent<<" "<<longest<<endl;
}

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

using namespace std;

int main()
{
    string word;
    string longest = "";
    pair<int, string> frequent = make_pair(0, "");
    map<string, int> dictionary;

    while (cin >> word)
    {
        dictionary[word] += 1;

        if (dictionary[word] > frequent.first)
        {
            frequent = make_pair(dictionary[word], word);
        }
        if (word.size() > longest.size())
        {
            longest = word;
        }
    }
    cout << frequent.second << " " << longest << endl;
}

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

using namespace std;

typedef pair<string, int> elem;

int main()
{
    map<string, int> cnt;
    map<string, int> len;

    string word;
    while (cin >> word) {
        if (cnt.count(word)) {
            cnt.at(word)++;
        } else {
            cnt.insert(elem(word, 1));
            len.insert(elem(word, word.size()));
        }
    }

    pair<string, int> mode("", 0);
    for (auto it = cnt.begin(); it != cnt.end(); it++) {
        if (it->second > mode.second) {
            mode = *it;
        }
    }

    pair<string, int> max_len("", 0);
    for (auto it = len.begin(); it != len.end(); it++) {
        if (it->second > max_len.second) {
            max_len = *it;
        }
    }

    cout << mode.first << " " << max_len.first << endl;

    return 0;
}

C++: #include<iostream>
#include<map>
using namespace std;
string a,b,s;
int A,B;
map<string,int>M;
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;
}