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<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


#define X real()
#define Y imag()
typedef complex<double> P;

int main(){
	
	typedef pair<int,string> pis;
	vector<pis> a;
	vector<pis> b;
	
	map<string,int> m;
	
	string str;
	while(cin>>str){
		a.push_back( pis((int)str.size(),str) );
		m[str]++;
	}
	
	map<string,int>::iterator it=m.begin();
	while(it!=m.end()){
		b.push_back(pis(-it->second,it->first));
		it++;
	}
	
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	
	cout<<b[0].second<<" "<<a[a.size()-1].second<<endl;
	
	
}

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)
        {
            N = table[word];
            frequent = word;
        }
        if(word.size()>longest.size())
            longest=word;
    }
    cout << frequent << " " << longest << endl;
}

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

int main() {
	string str[1000],tmp;
	int a[1000] = {}, flag = 0, max = 1, i, length = 0, num = 0;

	while (cin >> tmp) {
		if (flag == 0) {
			flag++;
			tmp[0] = tmp[0] - 'a';
		}
		for (i = 0; i < max; i++) {
			if (tmp == str[i]){
				a[i]++;
				break;
			}
		}
		if (i == max)
			str[i] = tmp;
	}

	if ((int)tmp.size() > length) {
		num = i;
		length = (int)tmp.size();
	}

	cout << str[max] << " " << str[length] << endl;
	return 0;
}

C++: #include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

int main(){
    string s;
    getline(cin,s);
    vector<string> str;
    s+=" ";
    string buf="";
    rep(i,s.size()){
        if(s[i]!=' '){
            buf+=s[i];
        }
        else{
            str.pb(buf);
            buf="";
        }
    }
    map<string,int> mp;
    rep(i,str.size()){
        mp[str[i]]++;
    }
    string ans="";
    int n=-1;
    rep(i,str.size()){
        if(mp[str[i]]>n){
            ans = str[i];
            n=mp[str[i]];
        }
    }
    string l="";
    int num=-1;
    rep(i,str.size()){
        if((int)(str[i].size())>num){
            num=str[i].size();
            l=str[i];
        }
    }
    cout<<ans<<" "<<l<<endl;
}

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

int main() {

  string s;
  map<string, int> names;

  while(cin>>s) {
    if(s=="") break;
    if( names.find(s) == names.end() ) {
      names.insert( map<string, int>::value_type(s,1) );
    }else{
      names[s]++;
    }
  }

  //cout<<"AA"<<endl;
  map<string, int>::iterator it = names.begin();
  int max=0,ml=0;
  string lo,fr;
  while( it != names.end() ) {
    //cout<<(*it).first<<" "<<(*it).second<<endl;
    if( (*it).second > max ) {
      max = (*it).second;
      fr = (*it).first;
    }
    if( (*it).first.length() > ml ) {
      ml = (*it).first.length();
      lo = (*it).first;
    }
    it++;
  }

  cout<<fr<<" "<<lo<<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){
        v.pb(s);
    }
    cout << int(v.size()) << endl;
    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<vv.size()){

            lmax=max(lmax,int(vv.size()));
            lind=i;
        }
    }
    cout << v[lind] << v[nind] << endl;
}

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

using namespace std;

/** Problem0029 : English Sentence **/
int main()
{
	map<string, int> sentences;
	pair<string, int> t;
	string tmp, maxLength;
	
	while (cin >> tmp) {
		if (tmp.length() > maxLength.length())
			maxLength = tmp;
		
		if (sentences.count(tmp) == 0) {
			sentences.insert(map<string,int>::value_type(tmp, 1));
		} else {
			sentences[tmp]++;
		}
	}
	
	t = *max_element(sentences.begin(), sentences.end());
	cout << t.first << " " << maxLength << endl;
	
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

int main(){
	string word, lword, rword;
	cin >> word;
	lword = word;
	rword = word;
	int count = 0;
	map<string, int> data;
	data[rword] = 1;

	while(cin >> word){
		if(lword.size() < word.size()) lword = word;
		data[word]++;
		if(data[word] > count){
			rword = word;
			count = data[word];
		}
	}
	cout << rword << " " << lword << endl;
	

}

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

int main(){
  map<string,int> words;
  int l_max=0, f_max=0;
  string longest, frequent;

  string word;
  while(cin >> word){
    words[word]++;
    if(word.size()>l_max){
      l_max=word.size();
      longest=word;
    }
    if(words[word]>f_max){
      f_max=words[word];
      frequent=word;
    }
  }
  cout << frequent << ' ' << longest << endl;

  return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main(){
	map<string , int> data;
	string mxlen,mst,str;

	while(cin >> str){
		data[str]++;
		if(data[str] > data[mst]){
			mst = str;
		}
		if(str.size() > mxlen.size()){
			mxlen = str;
		}
	}
	cout << mst << ' ' << mxlen << endl;
	return 0;
}

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

int main(){
	string s, str1, str2;
	int maxn = 0, maxl = 0;
	map<string, int> mp;
	while(cin >> s){
		
		
		//if(s == "0")break;
		
		
		for(int i = 0;i < s.size();i++){
			if(s[i]>='A' && s[i]<='Z')s[i] += 'a'-'A';
		}
		mp[s]++;
		if(mp[s] > maxn){maxn = mp[s];str1 = s;}
		int size = s.size();
		if(size > maxl){maxl = size;str2 = s;}
		cout << s << " ";
	}
	
	//cout << mp["have"];
	cout << str1 << " " << str2 << endl;
	return 0; 
}