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

int main() {
    map<string, int> words;
    string word, largestWord, mostFrequentWord;
    int maxLength = 0, mode = 0;    

    while (cin >> word) {
        words[word]++;
    }
    
    for (map<string, int>::iterator it = words.begin(); it != words.end(); ++it) {
        if (it->second > mode) {
            mode = it->second;
            mostFrequentWord = it->first;
        }
        if (it->first.size() > maxLength) {
            maxLength = it->first.size();
            largestWord = it->first;
        }
    }

    cout << mostFrequentWord << " " << largestWord << endl;
    return 0;
}

C++: // 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
#ifdef DAIJOBU
#include "/home/v-o_o-v/deb.h"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif 

using namespace std;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	int max_cnt = 0;
	map<string, int> m;
	string s;
	string t;
	while(cin >> s){
		m[s]++;
		if(t.size() < s.size())t = s;
		max_cnt = max(max_cnt, m[s]);
	}
	for(auto i:m){
		if(i.second == max_cnt)s = i.first;
	}
	cout << s << ' ' << t << '\n';
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<map>
using namespace std;
int main()
{
    char a[1005];
    string b,c;
    int i,j;
    while(cin.getline(a,1000))
    {
        map<string,int>M;
        int len = strlen(a);
        string s;
        s="";
        int m = -1,g=0,gg=-1;
        for(i=0;i<len;i++)
        {
            if(a[i]==' ')
            {
                if(M[s]==0)
                  M[s]++;
                else M[s]++;
                if(g>gg)
                {
                    gg=g;
                    c=s;
                    //cout<<g<<" "<<s<<endl;
                }
                if(M[s]>m)
                {
                    m=M[s];
                    b=s;
                }
                s="";
                g=0;
            }
            else
            {
                s+=a[i];
                g++;
            }
        }
        if(g>gg)
        {
            gg=g;
            c=s;
            //cout<<g<<" "<<s<<endl;
        }
        if(M[s]>m)
        {
            m=M[s];
            b=s;
        }
        cout<<b<<" "<<c<<endl;
    }
}

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

int main(){
    map<string, int> M;
    string s,slongest,smost;
    cin >> s;
    slongest = s;
    smost = s;
    M[s]++;

    while (cin >> s){
        M[s]++;
        if (s.size() >= slongest.size())
            slongest = s;
        if (M[s] > M[smost])
            smost = s;
    }
    cout << smost << " " << slongest << endl;
}

C++: #include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
  vector<string> str;
  string s;
  int cnt=0;
  int pointer[1000]={};
  pair<int,string> pis;
  pis=make_pair(0,"");
  while(cin>>s){
    int flag=1;
    for(int i=0;i<str.size();i++){
      if(str[i]==s){
	pointer[i]++;
	flag=0;
	break;
      }
    }if(flag){
      str.push_back(s);
      pointer[str.size()-1]++;
      if(pis.first<s.size()){
	pis.first=s.size();
	pis.second=s;
      }
    }
  }
  pair<int,int> poin;
  poin=make_pair(0,0);
  for(int i=0;i<str.size();i++){
    if(poin.first<pointer[i]){
      poin.first=pointer[i];
      poin.second=i;
    }
  }
  cout<<str[poin.second]<<" "<<pis.second<<endl;
  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
int main(){
	char ans[50][10000] = {{0}};
	char a[10000] = {0};
	scanf("%[^\n]",a);
	int cnt = 0;
	int mx_len = 0;
	char date[10000] = {0};
	a[strlen(a)] = ' ';
	for(int i = 0,j = 0; i <= strlen(a); i++){
        if(a[i] >= 'a' && a[i] <= 'z' || a[i] >= 'A' && a[i] <= 'Z'){
            ans[cnt][j] = a[i];
            j++;
        }
        else{
            cnt++;
            j = 0;
        }
	}
	for(int i = 0; i < cnt; i++){
        cout << ans[i] << endl;
	}
	return 0;
}

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

int main(void){
  int max=0, length=0;
  map<string,int> word; //文字列と回数
  vector<string> w;
  string str;

  while(cin >> str){
    w.push_back(str);

    if(word.find(str) != word.end() ){ //単語が重複
      word[str]++;
    }else{
      word.insert( pair<string, int>(str, 1));
    }
  }

  map<string,int>::iterator p;
  for(p = word.begin() ; p != word.end() ; p++){
    if( max < p->second) {
      max = p->second;
    }
  }
  for(p = word.begin() ; p != word.end() ; p++){
    if( max == p->second){
      cout << p->first << " ";
      break;
    }
  }
  for(int i=0 ; i<w.size() ; i++){
    if( length < w[i].size() ) {
      length = w[i].size();
    }
  }
  for(int i=0 ; i<w.size() ; i++){
    if( length==w[i].size() ){
      cout << w[i] << endl;
      break;
    }
  }
  return 0;
}

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


using namespace std;
struct ST{string str;int c;int z;};

int main(){

int i=0;
string str,sth,stl;
struct ST P[1001];
int max=0;
while(cin>>str){
//	for(int j=0;j<str.size();j++)
//	str[i] = tolower( str[i] );

P[i].str=str;P[i].c=0;P[i].z=(int)str.size();
i++;
}
for(int j=0;j<i;j++)
for(int k=i-1;k>j;k--)
	if(P[k-1].str>P[k].str)
//if(P[k-1].str>P[k].str)
//if(strcmp(P[k-1].str,P[k].str)>0)
{


struct ST TEM=P[k-1];P[k-1]=P[k];P[k]=TEM;
//cout<<"*";
}

for(int j=1;j<i;j++)
{if(P[j-1].str==P[j].str)P[j].c++;

}
max=0;
for(int j=0;j<i;j++)
{if(max<P[j].c){max=P[j].c;sth=P[j].str;}}
max=0;
for(int j=0;j<i;j++)
	if(P[j].z>max){max=P[j].z;stl=P[j].str;}

cout<<sth<<" "<<stl<<endl;

//for(int j=0;j<i;j++)
//	cout<<P[j].str<<P[j].z<<endl;

return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <map>
using namespace std;

#define FOR(i,a,b) for(long long int i=(a);i<(b);i++)
#define REP(i,n) for(long long int i=0;i<(n);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI 3.14159265358479

typedef long long ll;
typedef vector<long long int> vi;
typedef vector<long long int>::iterator vit;

int main(){
	map<string, int>table;
	string s, f, l;
	string::iterator it = s.begin();
	size_t n = 0;
	while (cin >> s){
		if (it == s.end())break;
		table[s]++;
		if (table[s] > n){
			n = table[s];
			f = s;
		}
		if (s.size() > l.size()){
			l = s;
		}
		it++;
	}
	cout << f << l << endl;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
vector<vector<char> >tmp;
vector<vector<int> >scr;
int main(){
	string s;
	string nagai;
	int naga=-1;
	map<string,int>m;
	while(cin>>s){
		if(naga<s.size()){naga=s.size();nagai=s;}
		m[s]++;
	}
	int ma=-1;
	string mas;
	map<string,int>::iterator it=m.begin();
	for(;it<m.end();it++){
		string t=it->first;
		if(ma<m[t]){ma=m[t];mas=t;}
	}
	cout<<mas<<" "<<nagai<<endl;
}