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 <map>
#include <algorithm>
using namespace std;

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

	while (cin >> s) {
		transform(s.begin(), s.end(), s.begin(), tolower);
		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<vector>
#include<list>
#include<iostream>
#include<string>
#include<string.h>
#include<unordered_map>
using namespace std;

int main() {
	string word;
	unordered_map<string, int> myhash;
	int maxLen = 0;
	string maxLenS;
	int maxCount = 0;
	string maxCountS;
	while (cin >> word) {
		if (word.length() > maxLen) {
			maxLen = word.length();
			maxLenS = word;
		}
		if (myhash.find(word) == myhash.end()) {
			myhash[word] = 1;
		}
		else {
			myhash[word]++;
		}
		if (myhash[word] > maxCount) {
			maxCount = myhash[word];
			maxCountS = word;
		}
	}
	cout << maxCountS << ' ' << maxLenS << endl;
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
    string s, t;
    getline(cin, s);
    map<string, int> m;
    istringstream is(s);
    while (is >> t) if (m.find(t) == m.end()) m[t] = 0; else m[t]++;

    vector<pair<int, string> > v1, v2;
    for (map<string, int>::iterator it = m.begin(); it != m.end(); ++it) {
        v1.push_back(make_pair(it->second, it->first));
        v2.push_back(make_pair(it->first.size(), it->first));
    }
    sort(v1.rbegin(), v1.rend());
    sort(v2.rbegin(), v2.rend());
    cout << v1[0].second << " " << v2[0].second << endl;

    return 0;
}

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

typedef pair<int,string> P;

int comp(const P& a, const P& b) {
	return (a.first > b.first);
}

int main() {
	vector<P> seq;
	string s;
	string maxstr = "";
	int pos;
	
	getline(cin, s);
	
	while (1) {
		pos = s.find(' ');
		string word = s.substr(0, pos);

		bool inserted = false;
		for (int i = 0; i < seq.size(); i++) {
			if (seq[i].second == word) {
				seq[i].first++;
				inserted = true;
			}
		}
		if (!inserted) {
			seq.push_back(P(1, word));
		}

		if (word.size() > maxstr.size()) {
			maxstr = word;
		}

		if (pos == string::npos)
			break;
		s = s.substr(pos+1);
	}

	sort(seq.begin(), seq.end(), comp);

	cout << seq[0].second << " " << maxstr << endl;

	return 0;
}