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>
using namespace std;int M,l;main(){string s,t,u;map<string,int>m;for(;cin>>u;t=t.size()<u.size()?u:t)if(++m[u]>M)M=m[u],s=u;cout<<s<<' '<<t<<endl;}

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

typedef complex<double> P;

string l(string s){
	//if( s[0] <= 'Z' ) s[0] = s[0] - 'Z' + 'z';
	return s;
}

int main(){
	map<string,int> d;
	string s;
	int mx = 0;
	string v = "";
	while( cin >> s ){
		mx = max(mx,++d[l(s)]);
		if( v.size() < s.size() ) 
			v = l(s);
	}
	for( auto i : d)
		if( mx == i.second) cout << i.first << " ";
	cout << v << endl;
		
	
			
			
}

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


typedef pair<string,int> p;
vector <p> ls(0);


int find(string s){
  for(int i=0; i<(int)ls.size(); i++){
    if(s==ls[i].first)return true;
  }
  return -1;
}

int main(){

  string in;
  int max=0,indx=0;
  string maxs="";

  while(cin>>in){
    int tmp=find(in);
    if(tmp==-1){
      ls.push_back( p(in,1) );
      if(in.size()>maxs.size()){ maxs = in;}
    }
    else{
      ls[tmp].second++;
      if(ls[tmp].second>max){
        max=ls[tmp].second;
        indx = tmp;
      }
    }

  }

  cout << ls[indx].first << " " << maxs << endl;

  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<map>

#define f first
#define s second
#define mp make_pair

#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()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

int main(){
  map<string,int> m;
  string str;
  string ans1 = "";
  string ans2 = "";
  int cnt = 0;
  while(cin>>str) m[str]++;
  FOR(it,m){
    if(it->f.size() > ans2.size())
      ans2 = it->f;
    if(cnt < it->s){
      ans1 = it->f;
      cnt  = it->s;
    }
  }
  cout << ans1 << " " << ans2 << endl;
  return 0;
}

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

char str[50];
char word[1000][50];
int count[1000];

int main(void)
{
	int i, j, ind, ind2;
	int c, len = 0;
	i = 0;
	
	while (scanf("%s", str) != EOF){
		
		c = 1;
		for (j = 0; j < i; j++){
			
			if (strcmp(str, word[j]) == 0){
				count[j]++;
				c = 0;
			}
		}
		
		if (c == 1){
			strcpy(word[i], str);
			
			if (strlen(word[i]) > len){
				len = strlen(word[i]);
				ind = i;
			}
			i++;
		}
	}
	ind2 = 0;
	
	for (j = 0; j < i; j++){
		
		if (count[ind2] < count[j]){
			ind2 = j;
		}
	}
	
	printf("%s %s\n", word[ind2], word[ind]);
	
	return (0);
}

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

int main(void)
{
  char s[40] = {};
  char str[1001][40] = {};
  int i;
  int count[1001];
  int longest = 0;
  int max = 0;
  char ans[2][40] = {};
  while(scanf("%s", s) != EOF){
    if(longest < strlen(s)){
      strcpy(ans[0], s);
      longest = strlen(s);
    }
    
    for(i = 0;;i++) { 
      if(strcmp(s, str[i]) == 0 ){
	count[i]++;
	break;
      }
    
      if (count[i] == 0){
	count[i]++;
	strcpy(str[i], s);
	break;
      }
    }

    for(i = 0; i < 1001; i++)
      if( max < count[i] ){
	max = count[i];
	strcpy(ans[1], str[i]);
      }
  }
  
  printf("%s %s\n", ans[1], ans[0]);

  return 0;
}

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

map<string, int> myMap;

int getAppearedNum(string str) {
  map<string, int>::iterator itr = myMap.find(str);
  if(itr == myMap.end()) {
    myMap[str] = 0;
  }
  else {
    myMap[str] += 1;
  }
  return myMap[str];
}

int main(void) {
  string target;
  string maxLengthWord;
  int maxLength = 0;
  int nowWordLength;

  int mode = 0;
  string modeWord;
  int nowAppearedNum;

  while(cin >> target) {
    nowWordLength = target.length();
    if(maxLength < nowWordLength) {
      maxLength = nowWordLength;
      maxLengthWord = target;
    }
    
    nowAppearedNum = getAppearedNum(target);
    if(nowAppearedNum > mode) {
      mode = nowAppearedNum;
      modeWord = target;
    }
  }

  cout << modeWord << " " << maxLengthWord << endl;


  return 0;
}

C++: #include<iostream>
#include<string.h>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

char str[1005];
char v[1005][33];
int  n[1005];
int main()
{
  int i,j,k=0;
  int maxi=0;

  gets(str);

  rep(i,1000){
    rep(j,33)
    {
      if(str[k]==' '|| str[k]=='\0'){
	v[i][j]='\0';
	k++;
	break;
      }
      v[i][j]=str[k];
      k++;
    }
    if(k>=strlen(str))break;
  }
  int num=i+1;

  rep(i,num)
    {
      n[i]=0;
    }

  rep(i,num){
    if( strlen(v[maxi]) < strlen(v[i]) )
      maxi=i;
    if(n[i])continue;
    for(j=i+1;j<num;j++){
      if(strcmp(v[i],v[j])==0){
	n[i]++;
	n[j]++;
      }
    }
  }
  int mode=0;

  for(i=1;i<num;i++)
    if(n[mode]<n[i])
      mode=i;

  cout<<v[mode]<<" ";
  cout<<v[maxi]<<endl;
}

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

using namespace std;

int main()
{
	string str[10000],mstr,lstr;
	int size=0,max=0,i,j;
	
	for(i=0;cin >> str[i];i++)
	{
		if(size<str[i].size())
			lstr=str[i];
	}
	for(j=0;j<i;j++)
	{
		int count=0;
		for(int k=j;k<i;k++)
			if(str[j]==str[k])
				count++;
		if(max<count)
		{
			max=count;
			mstr=str[j];
		}
	}
	cout << mstr << " " << lstr << endl;
}

C++: #include<iostream>
#include<string>
const int MAX_NUM_OF_STR = 1010;
using namespace std;

int main(){
	int cnt = -1, len = 0, tango = 0;
	string str[MAX_NUM_OF_STR], max, maxlen;
	
	while(cin >>str[tango]){
		int tmpcnt = 0;
		for(int i = 0; i <= tango; i++){
			if(str[i] == str[tango]){
				tmpcnt++;
			}
		}
		if(cnt < tmpcnt){
			max = str[tango];
			cnt = tmpcnt;
		}
		
		if(str[tango].size() > (unsigned)len){
			len = str[tango].size();
			maxlen = str[tango];
		}
		tango++;
	}
	cout <<max <<" " <<maxlen <<endl;
	return 0;
}

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

using namespace std;

map<string, int> table;
int main() {
    string word, frequent, longest;
    size_t N = 0;
    
    while (cin >> word) {
        table[word] += 1;
        if(table[word] > N){
            N = table[word];
            frequent = word;
        }
        if(word.size() > longest.size()){
            longest = word;
        }
    }
    cout << frequent << " " << longest << endl;
    
    return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>

using namespace std;

int main()
{
	int longlen = 0;
	string str, longstr;
	vector<pair<int, string> > vc;

	while (cin >> str)
	{
		if((int)strlen(str.c_str()) > longlen){
			longlen = strlen(str.c_str());
			longstr = str;
		}
		
		bool bl = true;
		vector<pair<int, string> >::iterator it = vc.begin();
		while(it != vc.end())
		{
			if(it->second == str){
				it->first--;
				bl = false;
			}
			it++;
		}

		if(bl){
			vc.push_back(make_pair(0, str));
		}
	}
	
	sort(vc.begin(), vc.end());

	cout << vc[0].second << " " << longstr << endl;

	return 0;
}