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 <iostream>
#include <map>
using namespace std;

int main(void){
  int maxCnt = 0, maxLen = 0;
  string maxCntStr,maxLenStr;
  map<string,int> cnt;
  string s;

  while(cin>>s){
    cnt[s]++;
    if(maxCnt < cnt[s]){
      maxCnt = cnt[s];
      maxCntStr = s;
    }
    if(maxLen < s.length()){
      maxLen = s.length();
      maxLenStr = s;
    }
  }
  cout<<maxCntStr<<" "<<maxLenStr<<endl;

  return 0;
}

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

#define MAX 512

int main(void){
	char words[MAX][33];
	int wcnt=0;
	int f[MAX], len[MAX];
	char word[33];
	int longest, mostf;
	
	while (scanf("%s", word)!=EOF){
		int wid=-1;
		for (int i=0; i<wcnt; i++){
			if (strcmp(word, words[i])==0){
				wid = i;
			}
		}
		if (wid==-1){
			strcpy(words[wcnt], word);
			len[wcnt] = strlen(word);
			f[wcnt] = 1;
			wcnt++;
		} else {
			f[wid]++;
		}
	}
	longest = mostf = 0;
	for (int i=0; i<wcnt; i++){
		if (len[longest] < len[i]) longest = i;
		if (f[mostf] < f[i]) mostf = i;
		printf("%s: %d %d\n", words[i], f[i], len[i]);
	}
	printf("%s %s\n", words[mostf], words[longest]);
	
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <map>

using namespace std;

int main(){
  vector<string> tmpwords;
  map<string, int> words;
  string tmp;
  while(cin >> tmp){

    auto itr = words.find(tmp);
    if(itr!=words.end()){
      words[tmp]++;
    }
    else{
      words.insert( map<string, int>::value_type(tmp, 1));
    }

  }

  cout << "here" << endl;
  
  int max=0;
  string maxStr;
  int frequence=0;
  string freStr;
  for(auto itr=words.begin();itr != words.end(); ++itr){
    if(max < (itr->first.size())){
      max = (itr->first.size());
      maxStr = itr->first;
    }
    if(frequence < (itr->second)){
      frequence = itr->second;
      freStr = itr->first;
    }
  }

  cout << maxStr << " " << freStr << endl;
  
}

C++: #include <iostream>
#include <map>
#include <string>
using namespace std;
typedef pair<int,int> P;
int main()
{
	string s;
	pair<string,int> mode=make_pair("",0),mlen=make_pair("",0);
	map<string,P> m;
	while(cin>>s){
		int d=++m[s].first;
		m[s].second=s.length();
		if(mode.second<d){mode=make_pair(s,d);}
		if(mlen.second<s.length()){mlen=make_pair(s,s.length());}
	}
	cout<<mode.first<<" "<<mlen.first<<endl;
	return 0;
}

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

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
//const int inf = 1e9 + 7;
//int dy[] = {0, 0, -1, 1};
//int dx[] = {1, -1, 0, 0};

int main() {
    string s;
    getline(cin, s);
    istringstream ss(s + "\n");
    map<string, int> mp;
    string longer;
    while (1) {
        string t; ss >> t;
        if (!ss.good()) break;
        mp[t]++;
        if (t.size() > longer.size()) longer = t;
    }
    string freq;
    int lerger = 0;
    for (auto it : mp) {
        if (it.second > lerger) {
            lerger = it.second;
            freq = it.first;
        }
    }
    cout << freq << " " << longer << endl;
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int const N = 1001;
int main(){
	char str[N][50];
	int num[N],i=0,max=0,l=0;
	while(cin >> str[i]){
		i++;
	}
	for(int j=0;j<i;j++){
		num[j]=0;
	}
	for(int j=0;j<i;j++){
		for(int k=0;k<i;k++){
			if(strcmp(str[j],str[k])==0)
		num[j]++;
		}
		if(num[max] < num[j])
			max = j;
		if(strlen(str[l]) < strlen(str[j]))
			l=j;
	}
	cout << str[max] << " " << str[l] << endl;
}

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

int main(){
	string in[1001];
	int num[1001], i=0, max=0, lon=0, ansa, ansb;

	for(int i=0;i<1001;i++){
		num[i] = 0;
	}

	while (true)
	{
		cin >> in[i];
		if (cin.eof()||in[i] == "0") { break; }
		for(int j=0;j<i;j++){
			if(in[i] == in[j]){
				num[j]++;
				continue;
			}
		}
		i++;
	}
	for(int j=0;j<i;j++){
		if (max < num[j]) {
			max = num[j];
			ansa = j;
		}
		if (lon < in[j].size()) {
			lon = in[j].size();
			ansb = j;
		}
	}
	cout << in[ansa] << " " << in[ansb] << endl;
	return 0;
}

C++: 
// mapはキー／値の対を保持する理想コンテナ
// 連想配列

#include <iostream>
#include <string>
#include <map>
#include <algorithm>

using namespace std;

int main(void){

  string s;
  map< string , int > count; // キーがstring型、値がintのmap
  string num;
  string len;

  while( cin >> s ){
    int c = ++count[s];                    //初期化は必要なし？  
    if( c > count[num] ) num = s;          //ここで単語
    if( s.size() > len.size() ) len = s;   //ここで文字数
  }
  cout << num << " " << len << endl;
  return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;

int main() {
	map<string, long long> mp;
	string S;
	while (cin >> S) mp[S]++;
	long long MAXA = 0, MAXB = 0;
	for (auto it = mp.begin(); it != mp.end(); it++) {
		MAXA = max(MAXA, it->second);
		MAXB = max(MAXB, (long long)(it->first.size()));
	}
	for (auto it = mp.begin(); it != mp.end(); it++) {
		if (it->second == MAXA) cout << it->first << " ";
	}
	for (auto it = mp.begin(); it != mp.end(); it++) {
		if (it->first.size() == MAXB) cout << it->first << endl;
	}
}

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

int main(){
  map<string,int> table;
  string word, frequent, longest;
  size_t N=0;
  while(cin >> word){
    table[word]+=1;
    if(table[word]>N){
      N = table[word];
      frequent = word;
    }
    if(word.size()>longest.size()){
      longest = word;
    }
    
  }

  cout << frequent << " " << longest << endl;
  return 0;
  
}

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

int main(){
	string in[1000];
	int max=0;
	int max_num;
	int tmp;
	string ans;
	int i=0;
	for(i=0;cin>>in[i];i++){
		if(in[i].size()>max){
			max=in[i].size();
			max_num=i;
		}
	}
	sort(in,in+i);
	tmp=1;
	max=0;
	for(int j=1;j<i;j++){
		if(in[j]==in[j-1]){
			tmp++;
		}else{
			if(max<tmp){
				max=tmp;
				ans=in[j-1];
				tmp=1;
			}
		}
	}
	cout<<ans<<" "<<in[max_num]<<endl;
}