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 <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)

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

int main(){
	char maxc[33],maxl[33],ss[1001][33];
	int a,b,cmax,i,c,count;
	
	memset(ss,'\0',sizeof(ss));
	i=0;
	while(0<=scanf(" %s ",ss[i])){
		++i;
	}
	maxl[0]=maxc[0]='\0';
	cmax=0;
	a=i;
	for(b=0;b<=i;++b){
		if(strlen(maxl)<strlen(ss[b])){
			strcpy(maxl,ss[b]);
		}
		count=0;
		for(c=0;c<=i;c++){
			if(!strcmp(ss[b],ss[c]))++count;
		}
		if(count>cmax){
			cmax=count;
			strcpy(maxc,ss[b]);
		}
	}
	printf("%s %s\n",maxc,maxl);
	return 0;
}

C++: #include<cstdio>
#include<cstring>
#include<string>

using namespace std;

string s[1001];
int count[1001];

int main(void){
	char temp[1001];
	
	while(gets(temp) != 0){
		int temp_n = strlen(temp);
		int c = 0;
		int max_h = 0;
		int max_H = 0;
		int max_l = 0;
		int max_L = 0;
		
		for(int i = 0; i < 1001; i++){
			s[i] = "";
			count[i] = 0;
		}
		
		for(int i = 0; i < temp_n; i++){
			for(int j = i; ; j++){
				if(temp[j] == ' '){
					i=j;
					c++;
					break;
				}else if(temp[j] == '\0'){
					i=j;
					c++;
					break;
				}
				s[c] += temp[j];
			}
		}
		
		for(int i = 0; i < c; i++){
			for(int j = 0; j < c; j++){
				if(i == j)continue;
				if(s[i] == s[j])count[i]++;
			}
		}
		
		for(int i = 0 ; i < c; i++){
			if(s[i].size() > max_L)max_l = i;
			if(count[i] > max_H)max_h = i;
		}
		
		printf("%s %s\n", s[max_h].c_str(), s[max_l].c_str() );
	}
	return 0;
}