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

char str[1100][34];
int  len[1100];
int n ;


string ans1 ="";

map<string,int> mp ;
void init_map(){
     mp.clear();
    for(int i=1;i<=n;i++){
        mp[str[i]] = 0 ;
    }
    for(int i=1;i<=n;i++){
       mp[str[i]]++;
    }
    int l =0;
    for( map<string,int>::iterator it = mp.begin();it!= mp.end();it++){
        if((it->second)>l){
	   ans1 = it->first;
	   l = it->second;
	}
    }            
}
int main(){
  int idx =1;
  while(~scanf("%s",str[idx])){
      len[idx] = strlen(str[idx]);
      idx ++;	
      
  }
   n = idx-1;
   init_map();
   cout << ans1<<" ";
    int l = 0;
    int maxidx  =0 ;
   for(int i=1;i<=n;i++){
      if(len[i]>l){
         maxidx = i;
	 l = len[i];
      }
   }
   cout << str[l]<<endl;
 return 0;
}

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

using namespace std;

int main(){
	string sent;
	string word[500];
	int a[500]={};
	int i,j,k,l;
	int n,m,len;
	i=0;
	while(cin>>sent){
		if(i==0){
			word[0]=sent;
			a[0]++;
			i++;
			len=sent.size();
			n=0;
		}
		else {
			if(len<sent.size()){
				len=sent.size();
				n=i;
			}
			for(j=0; j<i; j++){
				if(sent==word[j]){
					a[j]++;
					break;
				}
				if(j==i-1){
					word[i]=sent;
					a[i]++;
					i++;
					break;
				}
			}
		}
	}
	m=0;
	for(j=0; j<=i; j++){
		if(m<a[j])m=j;
	}
	cout<<word[m]<<" "<<word[n]<<endl;
	return 0;
}

C++: #include<stdio.h>
int main(void) {
   int i = 0;
   char s[1000][100];
   while ( scanf("%s", s[n] ) != EOF ) n++;
   for ( i = 0; i < n ; i ++ ) {
      
   printf("%s", s[2]);
   return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <sstream>
#include <complex>
#include <climits>
using namespace std;

#define REP(i,a,n) for(int i=(a);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define EPS 1e-8

int main(){
	map<string,int> msi;
	string in,lstr,mstr;
	int sz = 0;
	while(cin>>in){
		if( sz<in.size() ){
			lstr = in;
			sz = in.size();
		}
		msi[in]++;
	}
	map<string,int>::iterator it;
	int k = 0;
	for(it=msi.begin(); it!=msi.end(); it++){
		if( k < it->second ){
			k = it->second;
			mstr = it->first;
		}
	}
	cout << mstr << " " << lstr << endl;
	
	return 0;
}

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

int main() {
	string s,slong,nlong;
	vector<string> S;
	while (cin >> s) {
		S.push_back(s);
	}
	S[0][0] += 32;
	int sizeMAX = 0, ctr2 = 0;
	for (int i = 0; i < S.size(); i++) {
		int ctr1 = 0;
		for (int j = 0; j < S.size(); j++) {
			if (S[i] == S[j])ctr1++;
		}
		if (sizeMAX < S[i].size()) {
			slong = S[i]; sizeMAX = S[i].size();
		}
		if (ctr2 < ctr1) {
			ctr2 = ctr1; nlong = S[i];
		}
	}
	cout << nlong << " " << slong << endl;
	return 0;
}

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

C++: #include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

int main(){
	map<string,int> mp;
	ios::sync_with_stdio(false);
	string s;
	string a,b;
	b="";
	while (cin>>s){
		mp[s]++;
		if (s.length()>b.length()){
			b=s;
		}
	}
	int ma=0;
	for (auto ite=mp.begin();ite!=mp.end();ite++){
		if (ite->second > ma){
			ma = ite->second;
			a = ite->first;
		}
	}
	cout << a << " "<<b<<endl;
	return 0;
}

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

int main(){

	std::string str;
	std::getline(std::cin, str);

	std::vector<std::string> moji;
	std::vector<int> cost;

	std::string maxsize = "A";

	for (int i = 0, j = 0; i <= str.size(); i++){
		if (i == str.size() - 1 || str[i] == ' '){
			std::string s = str.substr(j, i - j);
			j = i + 1;

			std::vector<std::string>::iterator it = std::find(moji.begin(), moji.end(), s);
			if (it == moji.end()){
				moji.push_back(s);
				cost.push_back(1);
			}
			else {
				cost[it - moji.begin()]++;
			}

			if (s.size() > maxsize.size())maxsize = s;
		}
	}

	
	int maxhind = 0;
	std::string res;
	for (int i = 0; i < moji.size(); i++){
		if (cost[i]>maxhind){
			res = moji[i];
			maxhind = cost[i];
		}
	}

	std::cout << res << " " << maxsize << std::endl;

	return 0;
}

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;
  }
  cout <<(*cit).first <<" "<<(*sit).first;
}

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

int main(){
	vector<string> vs;
	map<string, int> msi;
	string s;
	string::size_type max_length = 0;
	while(cin >> s){
		max_length = max(max_length, s.size());
		vs.push_back(s);
		msi[s]++;
	}
	int max_f = 0;
	for(vector<string>::iterator iter = vs.begin();
		iter != vs.end(); iter++)
	{
		max_f = max(max_f,msi[*iter]);
	}
	for(vector<string>::iterator iter = vs.begin(); 
		iter != vs.end(); iter++)
	{
		if(msi[*iter] == max_f){
			cout << *iter << " ";
			break;
		}
	}
	for(vector<string>::iterator iter = vs.begin();
		iter != vs.end(); iter++)
	{
		if((*iter).size() == max_length){
			cout << *iter << endl;
		}
	}
	return 0;
}

C++: a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c)