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

int main(){
	map<string, int> word;
	vector<string> w;
	string str;
	int max=0,length=0;

	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;
		}
	}
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int const N = 1000;
int main(){
  char str[N][33];
  int num[N],i=0,max=0,l=0;
  while(cin >> str[i]){
    i++;
  }
  for(int j =0;j<i;j++){
    num[j] =j;
  }
  for(int j=0;j<i;j++){
    for(int k=0;k<i;k++){
      if(strcmp(str[j],str[k]) == 0)
	num[j]++;
    }
    if(num[max] < num[j])
      max = j;
    if(l < strlen(str[j]))
      l = j;
  }

  cout <<  str[max] <<" "<< str[l] << endl;
}

C++: #include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;
 
int main(){
    int m[1000],n=0,M=0,N=0,w,I,J,j;
    string r[1000],s;
    while(cin>>s){
        w=0;
        if(s.size()>M){M=s.size();I=n;}
        for(int i=0;i<n;i++)if(s==r[i]){m[i]++;w=1;j=i;break;}
        if(w==0){r[n]=s;m[n]=1;j=n;n++;}
        if(m[j]>N){N=m[j];J=j;}
    }
    cout<<r[J]<<" "<<r[I]<<endl;
}

C++: #include<iostream>
#include<vector>
using namespace std;
#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = a ; i < b ; i ++)

int main(void){
  string s,len="";
  getline(cin,s);
  
  s += ' ';
  vector<string> arys;
  string ss="";
  rep(i,s.size()){
    if(s[i] != ' '){
      ss += s[i];
    }else{
      arys.push_back(ss);
      if(len.size() < ss.size())len=ss;
      ss = "";
    }
  }
  vector<int> aryi(arys.size(),0);
  int n = arys.size(),used=0,index=-1;
  rep(i,n){
    loop(j,i,n){
      if(arys[i] == arys[j]){
        aryi[i]++;
        if(aryi[i] > used){
          index = i;
          used = aryi[i];
        }
      }
    }
  }
  
  cout<<arys[index]<<" "<<len<<endl;

}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){
  string s;
  map<string, int> mp;
  while (cin >> s) {
    mp[s]++;
  }
  string maxv = mp.rbegin()->first;

  int maxstr = 0;
  string ansstr;
  for (auto x : mp) {
    if (x.first.size() >= maxstr) {
      maxstr = x.first.size();
      ansstr = x.first;
    }

  }
  cout << maxv << " " << ansstr << endl;

}

C++: #include<iostream>
#include<map>
#include<string>
using namespace std;
int main()
{
    map<string,size_t> word_count;
    string word;
    while(cin>>word)
        ++word_count[word];
    map<string,size_t>::iterator a,b,c;
    a=b=word_count.begin();
    for( c=word_count.begin();c!=word_count.end();c++)
    {
        if(c->first.size()>a->first.size())
            a=c;
        if(c->second>b->second)
            b=c;
    }
    cout<<b->first<<' '<<a->first<<"\n";
    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]++;
		out=max(out,s.size());
	}
	int ma=0;
	string ans;
	for(auto it=m.begin();it!=m.end();it++){
		ma=max(ma,it->second);
		if(out==it->first.size());ans=it->first;
	}
	for(auto it=m.begin();it!=m.end();it++){
		if(it->second==ma)cout<<(it->first)<<" ";
	}
	cout<<ans<<endl;
}

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

using namespace std;

map<string, int> table;

int main(){
	string word, frequent, longest;
	size_t 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 << " " << longest << endl;
}

C++: #include<cstdio>
#include<cstring>
#include<iostream>
#include<queue>
#include<string>
using namespace std;
struct Eng {
  string str;
  int count;
};
int main(){
  Eng data[3333],temp;
  string str,box="\0";
  int f=0,num=0,flag;
  getline(cin , str);
  int str_size = str.size();
  for(int i=0;i<str_size;i++){
    if(str[i] == ' '){
      data[num].str = str.substr( f , i - f );
      for(int j=0;j<num;j++){
	if(data[num].str == data[j].str){
	  data[j].count++;	
	}
      }
      f = i + 1;
      num++;
    }
    else if(i == str_size-1){
      data[num].str = str.substr( f , i - f + 1  );
      for(int j=0;j<num;j++){
	if(data[num].str == data[j].str)data[j].count++;
      }
      num++;
    }
  }
  for(int i=0;i<num-1;i++){
    for(int j=num-1;j>i;j--){
      if(data[j].count>data[j-1].count){
	temp = data[j];
	data[j] = data[j-1];
	data[j-1] = temp;
      }
    }
  }
  for(int i=0;i<num;i++)
    if(box.size()<data[i].str.size())box = data[i].str; // 長さ確保
  cout << data[0].str << ' ' << box << endl;
}