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<cstdio>
#include<algorithm>
#include<string>
#include<iostream>

#define MAX(x,y) ((x,y)? x:y)

using namespace std;

string date[1000];

int main()
{
	for(int i=0;!cin.eof();i++){
		cin>>date[i];
	}
	sort(date,date+1000);
	int weitline=0;
	int maxline=0;
	string str;
	int str_i=0;
	for(int i=0;i<1000;i++)
	{
		if(str==date[i])str_i++;
		else 
		{
			str_i=1;
			str=date[i];
		}
		weitline =MAX(weitline,str_i);
		maxline=MAX(maxline,date[i].length());
	}
	string weitanswer;
	string maxanswer;

	for(int i=0;i<1000;i++)
	{
		if(str==date[i])str_i++;
		else 
		{
			str_i=1;
			str=date[i];
		}
		if(str_i==weitline)weitanswer=date[i];
		if(maxline==date[i].length()) maxanswer=date[i];
	}
	printf("%s %s\n");
	return 0;
}

C++: #include<iostream>
#include<cstring>
#include<string>
#define MAX 1060
using namespace std;
typedef struct{
	char s[MAX];
	int sum;
} gg;
char mstr[MAX],lstr[MAX],str[MAX],pre[MAX];
int lon=0,r,gs=0,mx=0;
gg sp[MAX];
void func(int x){
	int i;
	for(i=0;i<gs;i++){
		if(strncmp(sp[i].s,&str[x],r)==0){
			sp[i].sum++;
			break;
		}
	}
	if(i==gs){
		strncpy(sp[gs].s,&str[x],r);
		sp[gs++].sum=1;
	}
	if(sp[i].sum>mx){
		mx=sp[i].sum;
		strcpy(mstr,sp[i].s);
	}
}
int lo(int x){
	int i,k=0;
	for(i=x;isalpha(str[i]);i++)
		pre[k++]=str[i];
		return i-x;
}
void solve(){
	for(int i=0;str[i]!='\0';i++){
		if(isalpha(str[i])){
			r=lo(i);
			if(r>lon){
				lon=r;
				strcpy(lstr,&str[i]);
			}
			func(i);
			i+=(r-1);
		}
	}
}
int main(){
	while(cin.getline(str,MAX)){
		gs=0;mx=0;lon=0;
		solve();
		cout<<mstr<<' '<<lstr<<endl;
	}
	return 0;
}

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

using namespace std;

int main() {
	map<string, int> words;
	string word;
	int longest = 0, aliance = 0;
	while (cin >> word) {
		if (words.find(word) == words.end()) {
			int len = word.size();
			words[word] = 1;
			longest = max(longest, len);
		} else {
			int n = words[word];
			words[word] = n + 1;
		}
	}
	map<string, int>::iterator it;
	for (it = words.begin(); it != words.end(); it++)
		aliance = max(aliance, it->second);
	for (it = words.begin(); it != words.end(); it++)
		if (it->second == aliance) {
			cout << it->first;
			break;
		}
	for (it = words.begin(); it != words.end(); it++) {
		string s = it->first;
		if (s.size() == longest) {
			cout << " " << s << endl;
		}
	}

	return 0;
}

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

int main() {
  string strMxWC, strMxWL, str;
  map<string,int> mp;
  
  while(cin>>str) {
    mp[str]++;
    if(mp[strMxWC]<mp[str]) strMxWC=str;
    if(strMxWL.size()<str.size()) strMxWL=str;
  }
  cout << strMxWC << " " << strMxWL << endl;
  
  return 0;
}

C++: #include <fstream>
#include <sstream>
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <utility>
#include <algorithm>
using namespace std;

vector<string> split(const string &str, char delim){
  istringstream iss(str); string tmp; vector<string> res;
  while(getline(iss, tmp, delim)) res.push_back(tmp);
  return res;
}

int main() {
  string snt;
  getline(cin, snt);

  vector<string> words = split(snt, ' ');
  words[0][0] = tolower( words[0][0] );

  // for (int i = 0; i < words.size(); i++)
  //   cout << words[i] << endl;

  map<string, int> cnt;

  int M = words.size();
  int l;
  int mx_len = 0;
  for (int i = 0; i < M; i++) {
    // 最頻値
    if (cnt.count(words[i])) {
      cnt[ words[i] ]++;
    } else {
      cnt[ words[i] ] = 0;
    }
    // 最大長さの単語
    if (words[i].length() > mx_len) {
      mx_len = words[i].length();
      l = i;
    }
  }

  int f;
  int mx_f = 0;
  for (int i = 0; i < M; i++) {
    if (mx_f < cnt[ words[i] ]) {
      f = i;
      mx_f = cnt[ words[i] ];
    }
  }

  cout << words[f] << " " << words[l] << endl;
}

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!=EOF){
        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 <iostream>
#include <map>
#include <string>
#include <utility>
using namespace std;
int main() {
  map<string, int> word;
  string s, s1 = "", s2 = "";
  int a = 0;
  while (cin >> s)
    word[s]++;
  for (auto e : word) {
    if (a < e.second) s1 = e.first;
    if (s2.size() < e.first.size()) s2 = e.first;
  }
  cout << s1 << ' ' << s2 << endl;
  return 0;
}

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

using namespace std;

typedef map<string, int> freqmap;

freqmap fm;

int main() {
    string word;
    while (cin >> word) {
        fm[word]++;
    }

    string most_used;
    int most_used_i = 0;
    for (freqmap::iterator i = fm.begin(); i!= fm.end(); i++) {
        if (most_used_i < (*i).second) {
            most_used_i = (*i).second;
            most_used = (*i).first;
        }
    }
    cout << most_used << ' ';
    
    string max_length;
    int max_length_i = 0;
    for (freqmap::iterator j = fm.begin(); j != fm.end(); j++) {
        if (max_length_i < (*j).first.length()) {
            max_length = (*j).first;
            max_length_i = (*j).first.length();
        }
    }
    cout << max_length << endl;
    return 0;
}

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;
    vector<string> v;
    while(cin>>s){
        v.pb(s);
    }
    cout << v.size() << endl;
    for(i=0;i<v.size();i++){
        cnt=0;
        for(j=0;j<v.size();j++){
            if(v[i]==v[j]){
                cnt++;
            }
        }
        if(nmax<cnt){
            nmax=max(cnt,nmax);
            nind=i;
        }
        if(lmax<v[i].size()){
            lmax=max(lmax,v.size());
            lind=i;
        }
    }
    cout << v[lind] << v[nind] << endl;
}