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<stdio.h>
#include<string.h>
int main()
{
	int c=0,r=0,n=0,max=0,most=0,p,q;
	char str[1000][32],now;
	while(scanf("%c",&now)!=EOF)
	{
		if(now==' ')
		{
			str[r][c]='\0';
			r++;
			c=0;
			n++;
		}
		else
		{
			str[r][c++]=now;
		}
	}
	str[r][c]='\0';
	for(int i=0;i<=n;i++)
	{
		int same=0,temp=strlen(str[i]);
		if(temp>max)
		{
			max=temp;
			q=i;
		}
		for(int j=i+1;j<n;j++)
		{
			if(strcmp(str[i],str[j])==0)
				same++;
		}
		if(same>most)
		{
			most=same;
			p=i;
		}
	}
	printf("%s %s\n",str[p],str[q]);
}

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];
  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]++;
      }else if(i==k){//一度もでていなかったら
	strcpy(cpy[i],c);
      }
    }
    k++;
  }
  
  strcpy(ans1,cpy[0]);
  for(int i=0;i<k-1;i++){
    if(iti[i]<iti[i+1]){
      strcpy(ans1,cpy[i+1]);
    }
  }
  
  cout << ans1 << " " << ans << endl;
}

C++: #include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

map<int,string> map1;
map<string,int> map2;
int main() {
    string s;
    while(cin>>s) {
        map1[-s.size()]=s;
        map2[s]++;
    }

    auto it = map2.begin();
    int maxi=0;
    string ans;
    while(it!=map2.end()) {
        if(maxi<it->sc) {
            maxi = it->sc;
            ans=it->fr;
        }
        it++;

    }
    cout<<ans<<" ";
    cout<<(map1.begin()->sc)<<endl;

    return 0;
}

C++: #include<iostream>
#include<map>
#include<string>
using namespace std;
int main(){
	string b,mx; map<string,int> d;
	while(cin>>b){
		d[b]++; if(b.size()>mx.size())mx=b;
	}
	cout<<max_element(d.begin(),d.end())->first<<" "<<mx<<endl;
	return 0;
}

C++: #include<iostream>
#include<string>
#include<map>
using namespace std;
int main(){
  map<string,int> map;
  string s, mxc, mxl;
  int freq,len;
  while(cin >> s){
    if(map.find(s) == map.end()){
      map[s] = 1;
    }
    else{
      map[s]++;
    }

    if(map[s] > freq){
      freq = map[s];
      mxc = s;
    }
    if(s.size() > len){
      len = s.size();
      mxl = s;
    }

  }
  cout << mxc << " " << mxl << endl;
}

C++: #include<iostream>
#include<string>
#include<map>
using namespace std;
int main(){
  map<string,int> m;
  map<string,int>::iterator p;
  int ans=0,count=0; 
  string ans1 ,ans2;
  string s;
  while(cin >> s){
    ++m[s];
    if(ans<s.size()){
      ans = s.size();
      ans2 = s;
    }
  }
  p = m.begin();
  for(p=m.begin();p!=m.end();p++){
    if(count<p->second){
      count = p->second;
      ans1 = p->first;
    }
  }
  cout << ans1 << ' ' << ans2 << endl;
  return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#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()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	string s;
	map<string,int>m;
	int out=0;
	while(cin>>s){
		m[s]++;
		int d=s.size();
		out=max(out,d);
	}
	int ma=0;
	string ans="";
	for(map<string,int>::iterator it=m.begin();it!=m.end();it++){
		ma=max(ma,it->second);
		if(out==it->first.size())ans=it->first;
	}
	for(map<string,int>::iterator it=m.begin();it!=m.end();it++){
		if(it->second==ma)cout<<(it->first)<<" ";
	}
	cout<<ans<<endl;
}

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

using namespace std;

int main() {
  map<string, int> M;
  string word, fword, lword = "";
  int s = 0;
  while(cin >> word) {
    M[word]++;
    if(M[word] > s) {
      s = M[word];
      fword = word;
    }
    if(word.size() > lword.size()) lword = word;
  }
  cout << fword << " " << lword << endl;
  return 0;
}

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

int main(){
    string w,ans="";
    int n=0;
    map<string,int> s;
    while(cin>>w){
        s[w]++;
        n=max(n,s[w]);
        if(ans.size()<w.size()){ans=w;}
    }
    for(auto p=s.begin();p!=s.end();++p){
        if(p->second==n){cout<<p->first<<' ';}
    }
    cout<<ans<<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){
        if(s==EOF) break;
        v.pb(s);
    }
    for(i=0;i<int(v.size());i++){
        cnt=0;
        vv=v[i];
        for(j=0;j<int(vv.size());j++){
            if(v[i]==v[j]){
                cnt++;
            }
        }
        if(nmax<cnt){
            nmax=max(cnt,nmax);
            nind=i;
        }
        if(lmax<int(vv.size())){
            lmax=max(lmax,int(vv.size()));
            lind=i;
        }
    }
    cout << v[lind] << v[nind] << endl;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>

using namespace std;

const int M = 33;
const int N = 1001;

char text[N];
char word[N][M];
char tmp[M], ansm[M], ansl[M]; 

int cmp(const void *a, const void *b) {
	return strcmp((char *)a, (char *)b);
}

void solve(char text[]) {
	int len = strlen(text);
	int j = 0, k = 0;
	for (int i=0; i<len; ++i) {//分解文章 
		if (text[i] != ' ') word[k][j++] = text[i];
		else {
			if (j == 0) continue;
			word[k++][j] = '\0', j = 0;
		}
	}
	if (j) word[k++][j] = '\0';
	qsort(word, k, sizeof(word[0]), cmp);
	int maxs = -1;
	int cnt = 1;
	strcpy(tmp, word[0]);
	strcpy(ansl, word[0]);
	int maxl = strlen(word[0]);
	for (int i=1; i<k; ++i) {
		if (maxl < strlen(word[i])) maxl = strlen(word[i]), strcpy(ansl, word[i]);
		if (!strcmp(tmp, word[i])) ++cnt;
		else {
			if (maxs < cnt) {
				maxs = cnt;
				strcpy(ansm, tmp);
			}
			strcpy(tmp, word[i]);
		}
	}
	if (maxs < cnt) strcpy(ansm, tmp);
}

int main() {
	while (cin.getline(text, N, '\n')) {
		solve(text);
		cout<<ansm<<" "<<ansl<<endl;
	}
	return 0;
}