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<string>
#include<cstdlib>
#include<map>
#include<algorithm>

using namespace std;

int main(){
  string str;
  int max_len = 0;
  int max_fac = 0;
  string max_str1;
  string max_str2;
  map<string, int> map_str;
  while(cin >> str) {
    transform(str.begin(), str.end(), str.begin(), ::tolower);
    map_str[str]++;
  }

  map<string, int>::iterator it;
  for(it = map_str.begin(); it != map_str.end(); it++) {
    if(max_len < (it->first).size()) {
      max_len = (it->first).size();
      max_str1 = it->first;
    }
    if(max_fac < it->second) {
      max_fac = it->second;
      max_str2 = (it->first);
    }
  }

  cout << max_str2 << " " << max_str1 << endl;

  return 0;
}

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

using namespace std;

int main()
{
	string str[10000],mstr,lstr;
	int size=0,max=0,i,j;
	
	for(i=0;cin >> str[i];i++)
	{
		if(size<str[i].size())
			lstr=str[i];
	}
	for(j=0;j<i;j++)
	{
		int count=0;
		for(int k=j;k<i;k++)
			if(str[j]==str[k])
				count++;
		if(max<=count)
		{
			max=count;
			mstr=str[j];
		}
	}
	cout << mstr << " " << lstr << endl;
}

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

int main (void){

	string str,maxByLength("");
	//map<int,string> X; //¶Ì·³
	map<string,int> Y; //¶Ì
	//int mm;

	while (cin>>str){
		if (str.size()>maxByLength.size())	maxByLength=str;
		Y[str]++;
	}

	string maxByCount("");
	int cnt = 0;
	for(map<string, int>::iterator it = Y.begin(); it != Y.end(); ++it) {
		if(it->second > cnt) {
			maxByCount = it->first;
			cnt = it->second;
		}
	}

	cout << maxByCount << " " << maxByLength << endl;

	// cout << (*Y.rbegin()).first << " " << maxByLength << endl;
	return 0;

}

C++: #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <math.h>
#include <functional>
#include <algorithm>
#include <utility>

typedef long long Int;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
using namespace std;


map<string, int> aa;
set<string> dic;

int main(){
	string a;

	while (cin >> a){
		dic.insert(a);
		++aa[a];
	}

	int m = 0;
	string ms;

	int m2 = 0;
	string ms2;


	for (auto x : dic){
		if (m < x.length()){
			m = x.length();
			ms = x;
		}
	}

	for (auto x : aa){
		if (m2 < x.second){
			ms2 = x.first;
			m2 = x.second;
		}
	}

	cout << ms2 << " " << ms << endl;

	return 0;
}

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

int main() {
	map<string, int> ms;
	string s, ans, ans2;
	int max = 0, max2 = 0;
	
	while (cin >> s) {
		ms[s]++;
		if (max2 < ms[s]) {
			max2 = ms[s];
			ans2 = s;
		}
		if (max < s.size()) {
			max = s.size();
			ans = s;
		}
		
	}
	cout << ans2 << " " << ans << endl;
}

C++: //#define _GRIBCXX_DEBUG
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;


// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T>
constexpr int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F>
constexpr int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T>
void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C>
void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U>
constexpr void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U>
constexpr void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C>
constexpr void reverse(C& c) { reverse(ALL(c)); }
template<typename C>
constexpr void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred>
constexpr void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (int)(1e9+7)
#pragma endregion


int main()
{
    map<string, int> d;
    string s;
    while(cin>>s) d[s]++;
    string ans1 = "";
    int mx_count1 = 0;
    string ans2 = "";
    int mx_count2 = 0;
    for (auto el : d) {
        if(el.second>=mx_count1) {
            ans1 = el.first;
            mx_count1 = el.second;
        }
        if(el.first.size()>=mx_count2) {
            ans2 = el.first;
            mx_count2 = el.first.size();
        }
    }
    cout << ans1 << " " << ans2 << endl;
    return 0;
}

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' - 'A';
		}
		for (i = 0; i < max;i++) {
			if (tmp == str[i]) {
				a[i]++;
				break;
			}
		}

		if (i == max) {
			str[i] = tmp;
			max++;
		}

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

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

C++: #include<iostream>
#include<cstring>
#include<stdio.h>
#include<algorithm>
using namespace std;
char a[1010][100];
char b[10000];
int main()
{
	int i,j,l,s,m,n,p,k,s1,s2;
	while(gets(b))
	{
		memset(a,0,sizeof(a));
		l=strlen(b);
		j=0;p=0;n=0;s=0;
		for(i=0;i<l;i++)
		{
			if(b[i]!=' ')
			{
				char t=b[i];
				a[j][p++]=b[i];
			}
			else
			{
			//	cout<<p<<" --"<<endl;
				if(p>n)
				{
					n=p;
					m=j;
				}
				j++;
				p=0;
			}
		}
          if(p>n)
				{
					n=p;
					m=j;
				}
		int t=0;
		for(i=0;i<=j;i++)
		{
			s=0;
			for(s1=0;s1<=j;s1++)
			{
				if(strcmp(a[i],a[s1])==0)
					s++;
			}
			if(s>t)
			{
				t=s;
				s2=i;
			}
		}
		printf("%s %s\n", a[s2], a[m]);
	}
}

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

const int MAX_NUM_OF_STR = 1010;

int main(){
	int len = 0, tango = 0;
	string str[MAX_NUM_OF_STR], max, maxlen;
	map<string, int> string_cnt;
	
	while(cin >>str[tango]){
		string_cnt[str[tango]]++;
		
		if(str[tango].size() > (unsigned)len){
			len = str[tango].size();
			maxlen = str[tango];
		}
		tango++;
	}
	
	map<string, int>::iterator it = string_cnt.begin();
	int cnt = -1;
	string tmp;
	for(int i = 0 ; i < string_cnt.size(); it++, i++){
		if((*it).second > cnt){
			cnt = (*it).second;
			tmp = (*it).first;
		}
	}
	max = tmp;
	
	cout <<max <<" " <<maxlen <<endl;
	return 0;
}