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 <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(void){
	string s, l, m;
	map<string, int> map;
	int mxl = 0;
	int tmp = 0;
	while(cin >> s){
		map[s]++;
		if(map[s] > tmp){
			m = s;
			tmp = map[s];
		}
		int tmp_s = s.size();
		if(s.size() > mxl){
			mxl = max(mxl,tmp_s);
			l = s;
		}
	}
	cout << m << " " << l;
	return 0;
}

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

using namespace std;

int main()
{
	string wordMax;
	map<string, int> n;
	map<string, int>::iterator i, nMax;
	string a;

	wordMax = "";
	while (cin>>a) {
		if ( n.count(a) ) {	// aðkeyÉÂvfª éA»ÌlðCNg
			n[a] ++;
		} else {			// aðkeyÉÂvfªÈ¢A»ÌvfðÇÁ
			n.insert( map<string, int>::value_type(a, 1) );
		}
		if ( a.size() > wordMax.size() ) wordMax = a;
	}

	nMax = n.begin();
	for (i = n.begin(); i != n.end(); i++) {
		if ( (*i).second > (*nMax).second ) nMax = i;
	}

	cout<<(*nMax).first<<" "<<wordMax<<endl;

	return 0;
}

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

int main() {
	string str[50], tmp;
	int max_num = 0, max_length = 0, i, max = 1, max_str = 0, a[1001] = {};
	
	while (cin >> tmp) {
		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];

	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>
using namespace std;int main(){string s,m,l;for(map<string,int>d;cin>>s;l=s.size()>l.size()?s:l)m=++d[s]>d[m]?s:m;cout<<m<<" "<<l<<endl;return 0;}

C++: #include <string>
#include <vector>
#include <iostream>
#include <sstream>
#include <chrono>
   
typedef struct LettersInfo {
    std::string letters;
    unsigned int count;
} lettersInfo_s;
   
int main()
{
    std::string paramStr;
    std::getline(std::cin, paramStr);
   
    std::vector<lettersInfo_s*> lettersList;
   
    std::string letters;
    std::istringstream stream(paramStr);
   
    unsigned int maxLength = 0;
    std::string maxLengthStr;
   
    while (std::getline(stream, letters, ' ')) {
        unsigned int len = letters.size();
        if ( len != 0) {
            if ( maxLength < len ) {
                maxLengthStr = letters;
                maxLength = len;
            }
  
            unsigned int loopCount;
            for (loopCount = 0; loopCount < lettersList.size(); loopCount++) {
                if ( lettersList[loopCount]->letters == letters ) {
                    ++lettersList[loopCount]->count;
                    break;
                }
            }
  
            if (loopCount == lettersList.size()) {
                lettersInfo_s* plettersInfo = new lettersInfo_s();
                plettersInfo->letters = letters;
                ++plettersInfo->count;
                lettersList.push_back(plettersInfo);
            }
        }
    }
   
    unsigned int maxCount = 0;
    std::string maxCountStr;
    while( lettersList.size() > 0 ) {
  
        lettersInfo_s* plettersInfo = lettersList.back();
  
        unsigned int count = plettersInfo->count;
        if (maxCount < count) {
            maxCountStr = plettersInfo->letters;
            maxCount = count;
        }
        delete plettersInfo;
        lettersList.pop_back();
    }
   
    std::cout << maxCountStr << " " << maxLengthStr << std::endl;
   
    return 0;
}

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

map <string, int> dic;

string lowerword(string w){
    for (int i=0; i<(int)w.size(); i++)
        w[i] = tolower(w[i]);
    return w;
}

int main(void){

	string w1, w2;
	int l=0, m=0, tmp;

	while (true){
		string s;
		cin>>s;
		if (cin.eof()) break;
		s=lowerword(s);
		dic[s]++;

		tmp = dic[s];
		if (tmp>m){
			m = tmp;
			w1 = s;
		}
		tmp = s.size();
		if (tmp>l){
			l = tmp;
			w2 = s;
		}
	}
	cout<<w1<<" "<<w2<<endl;
	return 0;
}

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

using namespace std;

int debug = 0;

int main(void){
	string tmp;
	string max_len_word, max_times_word;
	unsigned int max_len = 0, max_times = 0;
	map<string, int> words;

	while(cin >> tmp){
		if(tmp.size() > max_len){
			max_len_word = tmp;
			max_len = tmp.size();
			if(debug) cout << "longest word overwritten." << endl;
		}
		words[tmp]++;
	}

	map<string, int>::iterator it;
	max_times=0;
	for(it=words.begin(); it!=words.end(); ++it){
		if(max_times < it->second){
			max_times_word = it->first;
		}
	}

	cout << max_times_word << " " << max_len_word << endl;

	return 0;
}

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

void solve(){

}
typedef pair<string,int> PSI;

int main(){
  string s;
  map<string, int> cnt;
  PSI mostcnt("",0), mostlen("",0);
  while(cin >> s){
    cnt[s]++;
    if(mostcnt.second < cnt[s]){
      mostcnt = PSI(s, cnt[s]);
    }
    if(mostlen.second < (int)s.size()){
      mostlen = PSI(s, s.size());
    }
  }
  cout << mostcnt.first << " " << mostlen.first << endl;
  
  return 0;
}

C++: #include<iostream>
#include<string>
#include<map>
#include<vector>
using namespace std;
template <class T>
bool find(vector<T> v, T key) {
	for (size_t i = 0; i < v.size(); i++)
		if (v[i] == key)return true;
	return false;
}
int main() {
	string s;
	getline(cin, s);
	vector<string>v;
	map<string, int>mp;
	int m = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == ' ') {
			string str = s.substr(m, i - m);
			if (find(v, str))mp[str]++;
			else { v.push_back(str); mp[str] = 1; }
		}
	}
	string ans1, ans2;
	int splatoon = 0;
	for (int i = 0; i < v.size(); i++) {
		if (mp[v[i]] > splatoon)ans1 = v[i];
		if (ans2.size() < v[i].size())ans2 = v[i];
	}
	cout << ans1 << ' ' << ans2 << '\n';
}