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>
using namespace std;

int main() {
	string str[10], 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 <map>
#include <algorithm>
#include <vector>
#include <iostream>
#include <string>
using namespace std;


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

    while (cin >> s){
	transform(s.begin(), s.end(), s.begin(), ::tolower);
	map<string, int>::iterator i = m.find(s);
	if (i == m.end()) m.insert(pair<string, int>(s, 1));
	else (*i).second++;
    }
    pair<string, int> freq("", 0);
    string len = "";
    for (map<string, int>::iterator i = m.begin(); i != m.end(); i++){
	if ((*i).first.size() > len.size()) len = (*i).first;
	if ((*i).second > freq.second){
	    freq.first = (*i).first;
	    freq.second = (*i).second;
	}
    }

    cout << freq.first << " " << len << endl;
}

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(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

int main(){
	map<string,int> mp;
	string s;
	getline(cin,s);
	vector<string> sent;

	int len=s.size();




	string maxStr="";
	int maxNum=-1;

	string tmp="";
	rep(i,len){
		if(s[i]!=' '){
			tmp+=s[i];
		}
		else{
			mp[tmp]+=1;
			sent.pb(tmp);
			if(maxNum<(int)tmp.size()){
				sent.pb(tmp);
				maxStr=tmp;
				maxNum=tmp.size();
			}
			tmp="";
		}
	}
	mp[tmp]+=1;
	sent.pb(tmp);
	if(maxNum<(int)tmp.size()){
		sent.pb(tmp);
		maxStr=tmp;
		maxNum=tmp.size();
	}

	string str="";
	int num=-1;
	for(int i=0;i<sent.size();i++){
		if(num<mp[sent[i]]){
			str=sent[i];
			num=mp[sent[i]];
		}

	}
	cout<<str<<endl;
	cout<<maxStr<<endl;


	return 0;
}

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

int main(){
	map<string,int> m;
	string s;
	while(cin>>s)++m[s];
	string often ,longest;
	for(map<string,int>::iterator it=m.begin();it!=m.end();++it){
		if(longest.length() < it->first.length())
			longest = it->first;
		if(m[often] < it->second)
			often = it->first;
	}
	cout<<often<<' '<<longest<<endl;
	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
// #define first first
// #define second se
using namespace std;
typedef pair<int, int> P;
typedef vector<int> vi;

signed main(){
    string s;
    getline(cin, s);
    map<string, int> mp;
    stringstream ss;
    ss << s;
    string t;
    int l = 0;
    string lw;
    while(ss >> t){
        mp[t]++;
        if(t.size() > l){
            l = t.size(); lw = t;
        }
    }
    int MAX = 0;
    string ans;
    for(auto it = mp.begin(); it != mp.end(); it++){
        if(MAX < it -> second){
            MAX = it -> second;
            ans = it -> first;
        }
    }
    cout << ans << " " << lw << endl;
}

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];
		}
	}
	in[i+1]="end";
	sort(in,in+i);
	tmp=1;
	max=0;
	cout<<in[0]<<" ";
	for(int j=1;j<=i;j++){
	cout<<in[j]<<" ";
		if(in[j]==in[j-1]){
			tmp++;
			//cout<<endl<<in[j]<<tmp<<endl;
		}else{
			if(max<tmp){
				max=tmp;
				
				ans=in[j-1];
				tmp=1;
			}
		}
	}
	cout<<endl<<ans<<" "<<ml_str<<endl;
}

C++: 
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i,n) for(int i=0; i<n; i++)
#define INF (1<<20)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

map<string, int> table;

int main()
{
	string word, frequent, longest="";
	int n = 0;
	while (cin >> word) {
		table[word]++;
		if (table[word] > n) {
			n = table[word];
			frequent = word;
		}
		if (word.size() > longest.size()) {
			longest = word;
		}
	}
	cout << frequent << " " << word << endl;
	return 0;
}

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

int main(void){

  int max_size=0,max_cnt=0;
  string word,result_cnt,result_size;
  map<string , int> word_cnt;

  while(cin >> word){

    cout << word << endl;
    if(word_cnt.find(word) != word_cnt.end()){
      word_cnt[word]++;      
    }else{
      int tmp = 1;
      word_cnt.insert(make_pair(word,tmp));
    }
  }

    for (map<string,int>::iterator ite=word_cnt.begin(); ite!=word_cnt.end(); ite++){
      if(max_cnt <  ite->second){
	max_cnt = ite->second;
	result_cnt = ite->first;
      }
      string w = ite->first;
      int w_size = w.size();
      if(max_size < w_size){
	max_size = w_size;
	result_size = ite->first;
      }
    }

    cout << result_cnt << ' ' << result_size << endl;



  return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<map>

using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl

#define rep(i,n) for(int i = 0; i < (n);++i)
#define repc(i,a,b) for(int i = (a);i <(b);++i)
#define repa(n,array) for(auto n :(array))

long long typedef ll ;
typedef vector<int> vi ;
typedef vector<ll> vl ;
//template<class Value>
//using dict = std::map< string, Value >;
typedef map<string,int> dict ;

constexpr int IMAX = ((1<<30)-1)*2+1 ;
constexpr int INF = 100000000;
double EPS = 1e-10 ;

typedef const pair<string, int> PSI;
bool cmpCount(PSI &T1, PSI &T2) {
    return T1.second < T2.second;
}

bool cmpLength(PSI &T1, PSI &T2) {
    return T1.first.length() < T2.first.length();
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string str ;
  dict M;
  while(cin >> str){
    if(M.count(str) == 0){
      M[str] = 0 ;
    }
    else{
      auto it = M.find(str) ;
      ++it->se ;
    }
  }
  PSI maxCount = *max_element(M.begin(), M.end(), cmpCount);
  PSI maxLength = *max_element(M.begin(), M.end(), cmpLength);

  cout << maxCount.first << " " << maxLength.first << endl;
  return 0;
}