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 <algorithm>
#include <map>
#include <vector>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define IREP(it,array) for(vector<int>::iterator it=array.begin(); it!=array.end(); ++it)
#define SREP(it,array) for(vector<string>::iterator it=array.begin(); it!=array.end(); ++it)
#define MP make_pair
typedef long long LL;
#define EPS (1e-6)
double zero(double d){
  return d < EPS ? 0.0 : d;
}

typedef pair<int,int> P;


int main()
{
  cout.setf(ios::fixed, ios::floatfield);
  cout.precision(7);
  int INF = 1000000;

  map<string,int> data;
  string str;
  while(cin >> str){
    data[str]++;
  }

  map<string,int>::iterator freq=data.begin();
  map<string,int>::iterator len=data.begin();

  for(map<string,int>::iterator it=data.begin(); it!=data.end(); ++it){
    if( (*freq).second < (*it).second )
      freq = it;
    if( (*len).first.length() < (*it).first.length() )
      len = it;
  }

  cout << (*freq).first << " " << (*len).first << endl;

  return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
const int MAX = (int)2e5 + 5;

int main() {
	string s;
	getline(cin, s);
	stringstream ss(s);
	map<string, int> m;
	string s2;
	string max_size_s;
	// dump(max_size_s.size());
	while (ss >> s2) {
		m[s2]++;
		if (s2.size() > max_size_s.size()) {
			max_size_s = s2;
		}
	}
	string most_fre_s;
	int most_fre_cnt = 0;
	for (auto p : m) {
		if (p.second > most_fre_cnt) {
			most_fre_s = p.first;
			most_fre_cnt = p.second;
		}
	}
	cout << most_fre_s << " " << max_size_s << endl;
	return 0;
}

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

using namespace std;

/** Problem0029 : English Sentence **/
int main()
{
	map<string, int> sentences;
	string tmp, maxLength, a;
	maxLength="";
	int A=0;
	
	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]++;
		}
		
		if (sentences[tmp] > A) {
			A = sentences[tmp];
			a = tmp;
		}
	}
	
	cout << a << " " << maxLength << endl;
	
	return 0;
}

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

using namespace std;
typedef long long LL;
static const double EPS = 1e-9;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n) 

int main(void){
  vector<int> count;
  vector<string> word;
  string tmp;
  while(cin>>tmp){
    if(find(word.begin(),word.end(),tmp) != word.end()){
      int d = distance(word.begin(), find(word.begin(),word.end(),tmp));
      count[d]++;
    }else{
      word.push_back(tmp);
      count.push_back(1);
    }
  }
  int maxn = 0,maxl = 0, mni, mli;
  
  REP(i,count.size()){
    if(count[i] > maxn) {
      maxn = count[i];
      mni = i;
    }
    if(word[i].size() > maxl){
      maxl = word[i].size();
      mli = i;
    }
  }
  cout << word[mni] << " " << word[mli] << endl;
  return 0;
}

C++: 
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <time.h>
#include <stdlib.h>
#include <set>
#include <stack>
#include <sstream>
#include <map>

using namespace std;

int main()
{
	map<string,int> mp;
	string s;
	getline(cin,s);
	string t,ls,ms;
	int n = 0;
	istringstream ss(s);
	while ( ss >> t )
	{
		int tn = ++mp[t];
		if ( t.size() > ls.size() )
			ls = t;
		if ( tn > n )
		{
			ms = t;
			n = tn;
		}
	}
	cout << ms << " " << ls;
	return 0;
}

C++: #include <iostream>
#include <cstring>
#include <string.h>
#include <cstdio>
using namespace std;
int main(){
  char c[1111];
  int len=0;
  int k=0;
  char maxc;
  int iti[1111]={0};//頻度高いよう
  char ans[1111];
  int sai=0;
  char ans1[1111];
  char cpy[1111][1111];
  while(scanf("%s",c)!=EOF){
    if(len<strlen(c)){//最長のもの
      len=strlen(c);
      strcpy(ans,c);
    }
    
    for(int i=0;i<k+1;i++){
      if(strcmp(cpy[i],c)==0){//すでに一度でていたら
	iti[i]++;
	break;
      }else if(i==k){//一度もでていなかったら
	strcpy(cpy[i],c);
      }
    }
    k++;
  }
  
  strcpy(ans1,cpy[0]);
  sai=iti[0];
  for(int i=0;i<k;i++){
    if(sai<iti[i]){
      sai=iti[i];
      strcpy(ans1,cpy[i]);
    }
  }
  /*for(int i=0;i<k;i++){
    cout << cpy[i] << " ";
    }*/

  cout << ans1 << " " << ans << endl;
}

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

int main(void){
  int maxCnt = 0, maxLen = 0;
  string maxCntStr,maxLenStr;
  map<string,int> cnt;
  string s;

  while(cin>>s){
    cnt[s]++;
    if(maxCnt < cnt[s]){
      maxCnt = cnt[s];
      maxCntStr = s;
    }
    if(maxLen < s.length()){
      maxLen = s.length();
      maxLenStr = s;
    }
  }
  cout<<maxCntStr<<" "<<maxLenStr<<endl;

  return 0;
}

C++: #include <stdio.h>
#include <string.h>

#define MAX 512

int main(void){
	char words[MAX][33];
	int wcnt=0;
	int f[MAX], len[MAX];
	char word[33];
	int longest, mostf;
	
	while (scanf("%s", word)!=EOF){
		int wid=-1;
		for (int i=0; i<wcnt; i++){
			if (strcmp(word, words[i])==0){
				wid = i;
			}
		}
		if (wid==-1){
			strcpy(words[wcnt], word);
			len[wcnt] = strlen(word);
			f[wcnt] = 1;
			wcnt++;
		} else {
			f[wid]++;
		}
	}
	longest = mostf = 0;
	for (int i=0; i<wcnt; i++){
		if (len[longest] < len[i]) longest = i;
		if (f[mostf] < f[i]) mostf = i;
		printf("%s: %d %d\n", words[i], f[i], len[i]);
	}
	printf("%s %s\n", words[mostf], words[longest]);
	
	return 0;
}

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

using namespace std;

int main(){
  vector<string> tmpwords;
  map<string, int> words;
  string tmp;
  while(cin >> tmp){

    auto itr = words.find(tmp);
    if(itr!=words.end()){
      words[tmp]++;
    }
    else{
      words.insert( map<string, int>::value_type(tmp, 1));
    }

  }

  cout << "here" << endl;
  
  int max=0;
  string maxStr;
  int frequence=0;
  string freStr;
  for(auto itr=words.begin();itr != words.end(); ++itr){
    if(max < (itr->first.size())){
      max = (itr->first.size());
      maxStr = itr->first;
    }
    if(frequence < (itr->second)){
      frequence = itr->second;
      freStr = itr->first;
    }
  }

  cout << maxStr << " " << freStr << endl;
  
}

C++: #include <iostream>
#include <map>
#include <string>
using namespace std;
typedef pair<int,int> P;
int main()
{
	string s;
	pair<string,int> mode=make_pair("",0),mlen=make_pair("",0);
	map<string,P> m;
	while(cin>>s){
		int d=++m[s].first;
		m[s].second=s.length();
		if(mode.second<d){mode=make_pair(s,d);}
		if(mlen.second<s.length()){mlen=make_pair(s,s.length());}
	}
	cout<<mode.first<<" "<<mlen.first<<endl;
	return 0;
}