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 <set>
#include <string>
using namespace std;

int main()
{
	string t;
	multiset<string> d;
	while (cin >> t)
	{
		d.insert(t);
	}

	t = *(d.begin());
	multiset<string>::iterator it;
	for (it=++d.begin(); it!=d.end(); it++)
	{
		if (d.count(t) < d.count(*it)) t = *it;
	}
	cout << t << ' ';

	t = *(d.begin());
	for (it=++d.begin(); it!=d.end(); it++)
	{
		if (t.size() < it->size()) t = *it;
	}
	cout << t << endl;

	return 0;
}

C++: #include <map>
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
int main(){
	std::string s;
	std::map<std::string,int> M;
	int maxlen=0;
	while(std::cin>>s){
		maxlen = std::max(maxlen, (int)s.size());
		M[s]++;
	}
	int maxapp=0;
	for(std::map<std::string,int>::iterator it = M.begin(); it != M.end(); ++it){
		maxapp = std::max(maxapp, it->second);
	}	
	for(std::map<std::string,int>::iterator it = M.begin(); it != M.end(); ++it){
		if(maxapp == it->second)std::cout<<it->first<<" ";
	}
	for(std::map<std::string,int>::iterator it = M.begin(); it != M.end(); ++it){
		if(maxlen == (it->first).size())std::cout<<it->first<<std::endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
  int c=0;
  string s,large="",max;
  map<string,int>wordbox;
  while(cin>>s){
    wordbox[s]++;
    if(s.length()>large.length())large=s;
  }
  map<string,int>::iterator it=wordbox.begin();
  while(it!=wordbox.end()){
    if((*it).second>c)max=(*it).first,c=(*it).second;
    it++;
  }
  cout<<max<<" "<<large<<endl;
  return 0;
}

C++: #include<iostream>
#include<vector>
#include<sstream>
#include<string>
using namespace std;
int main(){
  string str;getline(cin,str);stringstream ss(str);
  vector<string> v;vector<int> n;
  while(ss >> str){
    bool f=0;
    for(int i=0;i<v.size();i++){
      if(str==v[i]) {
	n[i]++;f=1;
      }
    }
    if(!f){
      v.push_back(str);
      n.push_back(1);
    }
  }
  str="";int c=0;
  for(int i=0;i<v.size();i++){
    if(c<n[i]) c=n[i];
  }
  for(int i=0;i<v.size();i++){
    if(n[i]==c) cout << v[i];
    if(str.size()<v[i].size()) str=v[i];
  }cout << " " << str << endl;
}

C++: #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define pb         push_back
#define mp         make_pair
#define ll         long long
#define PI         acos(-1.0)
#define ALL(A)     ((A).begin(), (A).end())
#define vsort(v)   sort(v.begin(),v.end())
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)


int main(){
    int i, j, lmax=0, lind=0, nmax=0, nind=0, cnt=0, vsize;
    string s,vv;
    vector<string> v;
    while(cin>>s){
        v.pb(s);
    }
    cout << v.size() << endl;
    for(i=0;i<v.size();i++){
        cnt=0;
        for(j=0;j<v.size();j++){
            if(v[i]==v[j]){
                cnt++;
            }
        }
        if(nmax<cnt){
            nmax=max(cnt,nmax);
            nind=i;
        }
        if(lmax<v[i].size()){
            vv=v[i];
            lmax=max(lmax,vv.size());
            lind=i;
        }
    }
    cout << v[lind] << v[nind] << endl;
}

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

using namespace std;

int main(){
	string sent;
	string word[500];
	int a[500]={};
	int i,j,k,l;
	int n,m,len;
	i=0;
	while(cin>>sent){
		if(i==0){
			word[0]=sent;
			a[0]++;
			i++;
			len=sent.size();
			n=0;
		}
		else {
			if(len<sent.size()){
				len=sent.size();
				n=i;
			}
			for(j=0; j<i; j++){
				if(sent==word[j]){
					a[j]++;
					break;
				}
				if(j==i-1){
					word[i]=sent;
					a[i]++;
					i++;
				}
			}
		}
	}
	m=0;
	for(j=0; j<=i; j++){
		if(m<a[j])m=j;
	}
	cout<<word[m]<<" "<<word[n]<<endl;
	return 0;
}

C++: #include <iostream>
#include <string>
#include <map>
using namespace std;
int main()
{
	int maxtime = 0, maxlen = 0;
	string str, maxTimeWord, maxLenWord;
	map<string, int> word;
	while (cin >> str)
	{
		if ((signed)str.length() > maxlen)
			maxlen = str.length(), maxLenWord = str;
		if ((word[str]++) >= maxtime)
			maxtime = word[str], maxTimeWord = str;
		if (cin.get() == '\n') break;
	}
	cout << maxTimeWord << " " << maxLenWord << endl;

	return 0;
}

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

using namespace std;

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

	while (cin >> s) {
		m[s]++;
		if (s.size() > max_length_string.size() ) {
			max_length_string = s;
		}
	}

	// 最頻値を求める
	int max = 0;
	string mode = "";
#if 0
	for ( auto x : m ) {
		if (x.second > max) {
			mode = x.first;
			max = x.second;
		}
	}
#else
	for (map<string,int>::iterator it = m.begin(); it != m.end(); it++) {
		if (it->second > max) {
			mode = it->first;
			max = it->second;
		}
	}
#endif
	cout << mode << " " << max_length_string << endl;

	return 0;
}

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

char str[1100][34];
int  len[1100];
int n ;


string ans1 ="";

map<string,int> mp ;
void init_map(){
     mp.clear();
    for(int i=1;i<=n;i++){
        mp[str[i]] = 0 ;
    }
    for(int i=1;i<=n;i++){
       mp[str[i]]++;
    }
    int l =0;
    for( map<string,int>::iterator it = mp.begin();it!= mp.end();it++){
        if((it->second)>l){
	   ans1 = it->first;
	   l = it->second;
	}
    }            
}
int main(){
  int idx =1;
  while(~scanf("%s",str[idx])){
      len[idx] = strlen(str[idx]);
      idx ++;	
      
  }
   n = idx-1;
   init_map();
   cout << ans1<<" ";
    int l = 0;
    int maxidx  =0 ;
   for(int i=1;i<=n;i++){
      if(len[i]>l){
         maxidx = i;
	 l = len[i];
      }
   }
   cout << str[l]<<endl;
 return 0;
}

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

using namespace std;

int main(){
	string sent;
	string word[500];
	int a[500]={};
	int i,j,k,l;
	int n,m,len;
	i=0;
	while(cin>>sent){
		if(i==0){
			word[0]=sent;
			a[0]++;
			i++;
			len=sent.size();
			n=0;
		}
		else {
			if(len<sent.size()){
				len=sent.size();
				n=i;
			}
			for(j=0; j<i; j++){
				if(sent==word[j]){
					a[j]++;
					break;
				}
				if(j==i-1){
					word[i]=sent;
					a[i]++;
					i++;
					break;
				}
			}
		}
	}
	m=0;
	for(j=0; j<=i; j++){
		if(m<a[j])m=j;
	}
	cout<<word[m]<<" "<<word[n]<<endl;
	return 0;
}

C++: #include<stdio.h>
int main(void) {
   int i = 0;
   char s[1000][100];
   while ( scanf("%s", s[n] ) != EOF ) n++;
   for ( i = 0; i < n ; i ++ ) {
      
   printf("%s", s[2]);
   return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <sstream>
#include <complex>
#include <climits>
using namespace std;

#define REP(i,a,n) for(int i=(a);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define EPS 1e-8

int main(){
	map<string,int> msi;
	string in,lstr,mstr;
	int sz = 0;
	while(cin>>in){
		if( sz<in.size() ){
			lstr = in;
			sz = in.size();
		}
		msi[in]++;
	}
	map<string,int>::iterator it;
	int k = 0;
	for(it=msi.begin(); it!=msi.end(); it++){
		if( k < it->second ){
			k = it->second;
			mstr = it->first;
		}
	}
	cout << mstr << " " << lstr << endl;
	
	return 0;
}