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++: a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c)

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

    //???????????°?????????Max????¶??????????
    if(map[s] > freq){
      freq = map[s];
      mxc = s;
    }
    //??????????????????Max????¶??????????
    if(s.size() > len){
      len = s.size();
      mxl = s;
    }

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

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

using namespace std;

int main(){
	string s;
	map<string, int> counter;
	string maxnum;
	string maxlen;
	while(cin >> s){
		int c = ++counter[s];
		if(c > counter[maxnum]){ maxnum = s; }
		if(s.size() > maxlen.size()){ maxlen = s; }
	}
	cout << maxnum << " " << maxlen << endl;
	return 0;
}

C++: //
//  main.cpp
//  kazane
//
//  Created by h3036136 on 2017/07/27.
//  Copyright ?? 2017??´ h3036136. All rights reserved.
#include <iostream>
#include <string>
using namespace std;
int main(){
    long saidai=0;
    int a=0,cnt=0,num=0,max=0,t;
    string str,tango[1000]={""},answer,ans;
    getline(cin,str);
    for(int i=0;i<str.size();i++){
        if(str[i]==' '){
            for(int j=a;j<i;j++){
                tango[cnt]+=str[j];
            }
            cnt=cnt+1;
            a=i+1;
        }
    }
    for(int p=a;p<str.size();p++){
        tango[cnt]+=str[p];
    }
    
    
    
    for(int k=0;k<=cnt;k++){
        if(saidai<tango[k].size()){
            saidai=tango[k].size();
            ans=tango[k];
        }
    }
    
    for(int s=0;s<cnt;s++){
        num=1;
        for(t=s+1;t<=cnt;t++){
            if(tango[s]==tango[t]){
                num=num+1;
            }
        }
        if(max<num){
            max=num;
            answer=tango[s];
        }
    }
    cout<<answer<<" "<<ans<<endl;
    return 0;
}

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

#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int main(){
	int cnt1=0,cnt2=0,tmp=0,anss1=0,anss2=0;
	string str,ans1,ans2,a;
	vector<string> v;

	getline(cin,str);
	for(int i=0;i<str.size()+1;i++){
		if(str[i]==' ' || i==str.size()){
			a=str.substr(tmp,i-tmp);
			v.push_back(a);
			tmp=i+1;
			cnt1++;
		}
	}
	for(int i=0;i<cnt1;i++){
		for(int j=0;j<cnt1;j++){
			if(v[i]==v[j]){
				cnt2++;
			}
		}
		if(anss1<cnt2){
			anss1=cnt2;
			ans1=v[i];
		}
		if(anss2<v[i].length()){
			anss2=v[i].length();
			ans2=v[i];
		}
		cnt2=0;
	}
	cout << ans1 << ' ' << ans2 << endl;
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
    long saidai=0;
    int a=0,cnt=0,num=0,max=0;
    string str,tango[1000]={"0"},answer,ans;
    getline(cin,str);
    for(int i=0;i<str.size();i++){
        if(str[i]==' '){
            for(int j=a;j<i;j++){
                tango[cnt]+=str[j];
            }
            cnt=cnt+1;
            a=i+1;
        }
    }
    for(int p=a;p<str.size();p++){
        tango[cnt]+=str[p];
    }
    for(int k=0;k<1000;k++){
        if((tango[k]=="0"))break;
        if(saidai<tango[k].size()){
            saidai=tango[k].size();
            ans=tango[k];
        }
    }
    
    for(int s=1;s<=cnt;s++){
        for(int t=s+1;t<=cnt;t++){
            if(tango[s]==tango[t]){
                num=num+1;
            }
        }
        if(max<num){
            max=num;
            answer=tango[s];
        }
    }
    cout<<answer<<" "<<ans<<endl;
    return 0;
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int const N = 1000;
int main(){
  char str[N][29];
  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 <algorithm>
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;

int main() {
    unordered_map<string, int> table;
    string frequent;    // 最大頻度
    string longest;     // 最長
    string word;        // 入力
    while (cin >> word) {
        table[word]++;
        if (table[word] > table[frequent]) {
            frequent = word;
        }
        if (word.length() > longest.length()) {
            longest = word;
        }
    }
    cout << frequent << " " << longest << endl;
    return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
  multiset<string> mset;
  string s;
  int maxlen = 0, maxc = 0;
  string ans, ans2;
  while(cin>>s) {
    mset.insert(s);
    if (maxlen<s.length()) {
      maxlen = s.length();
      ans2 = s;
    }
    if (maxc<mset.count(s)) {
      maxc = mset.count(s);
      ans = s;
    }
  }
  cout << ans << " " << ans2 << endl;
  
  
}