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 <string>
#include <vector>
#include <utility>
#include <algorithm>

using namespace std;

int main()
{
	int longlen = 0;
	string str, longstr;
	vector<pair<int, string> > vc;

	while (cin >> str)
	{
		if((int)strlen(str.c_str()) > longlen){
			longlen = strlen(str.c_str());
			longstr = str;
		}
		
		bool bl = true;
		vector<pair<int, string> >::iterator it = vc.begin();
		while(it != vc.end())
		{
			if(it->second == str){
				it->first--;
				bl = false;
			}
			it++;
		}

		if(bl){
			vc.push_back(make_pair(0, str));
		}
	}
	
	sort(vc.begin(), vc.end());

	cout << vc[0].second << " " << longstr << endl;

	return 0;
}

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

typedef complex<double> P;

string l(string s){
	if( s[0] <= 'Z' ) s[0] = s[0] - 'Z' + 'z';
	return s;
}

int main(){
	map<string,int> d;
	string s;
	int mx = 0;
	string v = "";
	while( cin >> s ){
		mx = max(mx,++d[l(s)]);
		if( v.size() < s.size() ) 
			v = l(s);
	}
	for( auto i : d)
		if( mx == i.second) cout << i.first << " ";
	cout << v << endl;
		
	
			
			
}

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

int main() {
	string str[1001], tmp;
	int max_num = 0, max_length = 0, i, max = 1, max_str = 0, a[1001] = {};
	
	while (cin >> tmp,tmp[0] != 'EOF') {
		for (i = 0; i < tmp.size(); i++) {
			if ('A' <= tmp[i] && tmp[i] <= 'Z')
				tmp[i] = tmp[i] + 'a' - 'A';
		}

		for (i = 0; i < max; i++) {
			if (str[i] == tmp) {
				a[i]++;
				if (max_str < a[i]) {
					max_str = a[i];
					max_num = i;
				}
				if (tmp.size() > max_length)
					max_length = (int)tmp.size();
				break;
			}
		}
		if (i >= max) {
			str[i-1] = tmp;
			max++;
			a[i - 1]++;
			if (max_str < a[i-1]) {
				max_str = a[i - 1];
				max_num = i - 1;
			}
			if (tmp.size() > max_length)
				max_length = (int)tmp.size();
		}
	}
	cout << str[max_num] << endl;

	for (i = 0; i < max; i++) {
		if ((int)str[i].size() == max_length)
			cout << str[i] << endl;
	}
	return 0;
}

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

int main()
{	
	string s, t;
	map<string, int> p;

	while (cin >> s) {
		if (p.find(s) != p.end())
			p[s]++;
		else
			p[s] = 1;

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

	int m = 0;

	for (map<string, int>::iterator itr = p.begin(); itr != p.end(); itr++)
		m = max(m, itr->second);

	for (map<string, int>::iterator itr = p.begin(); itr != p.end(); itr++)
		if (itr->second == m)
			cout << itr->first << endl;

	cout << t << endl;

	return 0;
}

C++: #include<iostream>
using namespace std;
#include<cstdio>
#include<cstring>
#include<string>
int main(){
  char mozi[1001][33],lenm[33],hind[33];
  int len=0,i=0,mozisu,count,max=-1;
  while(scanf("%s",mozi[i])!=EOF){
    len=strlen(mozi[i]);
    for(int j=0;j<len;j++){
      if(mozi[i][j]>='A' && mozi[i][j]<='Z'){
	mozi[i][j]+='a'-'A';
      }
    }
    if(mozisu<len){
     mozisu=len;
      strcpy(lenm,mozi[i]);
    }
    ++i;
  }
  for(int j=0;j<i+1;j++){
    count=0;
    for(int k=j+1;k<i+1;k++){
      if(!strcmp(mozi[j],mozi[k])){
	count++;
      }
    }
    if(max<count){
      max=count;
      strcpy(hind,mozi[j]);
    }
  }
  cout<<hind<<" "<<lenm<<endl;
}

C++: #include <iostream>
#include <map>
#include <string>
using namespace std; map<string,int>RB;int main() {string T;while ((cin>>T)!=NULL) {for (int i=T.length()-1;i>=0;i--) if (T[i]<='Z') T[i]+=32;RB[T]++;}
map<string,int>::iterator it=RB.begin(),ot=it++;for (;it!=RB.end();it++) if ((it->second)>(ot->second)) ot=it;cout<<ot->first<<" ";it=RB.begin();ot=it++;for (;it!=RB.end();it++) if ((it->first).length()>(ot->first).length()) ot=it;cout<<ot->first<<endl;return 0;}

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

int main()
{
    string line;
    string field;
    map<string, int> mp;
    string frequently_word;
    string max_num_word;
    int freq_count = 0;
    int max_letter_num = 0;

    getline(cin, line);    
    istringstream stream(line);

    /* ??????????????????????????? */
    while (getline(stream, field, ' '))
    {
        /* ?????§????????°?????????????????? */
        if(field.size() > max_letter_num)
        {
            max_num_word = field;
        }
        /* ????????????????????°??????????????? */
        if(mp.count(field)) 
        {
            mp[field]++; 
        }
        else
        {
            mp[field] = 1;
        }
 
    }
    /* ??????????????????????????? */
    for(auto itr = mp.begin(); itr != mp.end(); ++itr)
    {
        if(itr->second > freq_count)
        {
            frequently_word = itr->first;
        }
    }
    cout << frequently_word << " " << max_num_word << endl;

    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()

int main() {
    vector<string> words;
    string s;
    while(cin >> s) words.push_back(s);
    string longest;
    int longestlen = 0;
    REP(i,words.size()) {
        if (words[i].size() > longestlen) {
            longest = words[i];
            longestlen = words[i].size();
        }
    }
    
    map<string, int> mp;
    string frequent;
    int frequency = 0;
    REP(i,words.size()) {
        mp[words[i]] = 0;
    }
    REP(i,words.size()) {
        mp[words[i]]++;
        if (mp[words[i]] > frequency) {
            frequent = words[i];
            frequency = mp[frequent];
        }
    }
    
    cout << frequent << " " << longest << endl;

    return 0;
}

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

using namespace std;

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

C++: #include <iostream>
#include <string>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
#define make_pair mk
typedef pair<int, int> P;

int main(){
	string input;
	map<string, P> data;
	int maxlen = 0, maxcnt= 0;
	string lenst, cntst;
	while( cin >> input ){	
		if( data.find(input) == data.end() ){
			data.insert( pair<string, P>(input, P(input.size(), 1)) );
			//maxlen = max(maxlen, (int)input.size());
			if( maxlen < input.size() ){
				maxlen = input.size();
				lenst = input;
			}
		}else{
			//data[input].second++;
			if( maxcnt < data[input].second++ ){
				maxcnt = data[input].second;
				cntst = input;
			}
		}
	}
	/*map<string, P>::iterator it = data.begin();
	for( ; it != data.end(); it++ ){
		cout << (*it).first << "," << (*it).second.first << "," << (*it).second.second << endl;
	}*/
	cout << cntst << " " << lenst << endl;
}