Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	l := sc.Text()
	words := strings.Split(l, " ")

	frequency := map[string]int{}
	long := map[string]int{}
	var maxFrequency, longest int
	var frequentWord, longestWord string
	for _, w := range words {
		frequency[w]++
		long[w] = len(w)
		if frequency[w] > maxFrequency {
			maxFrequency = frequency[w]
			frequentWord = w
		}
		if len(w) > longest {
			longest = long[w]
			longestWord = w
		}
	}

	fmt.Println(frequentWord + " " + longestWord)
}

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

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<iostream>
#include<string>
using namespace std;

int main() {
	string str[1001], tmp;
	int max_num = 0, max_length = 0, i, max = 1, max_str = 0, a[1001] = {};
	
	while (cin >> tmp,tmp[0] != 'EOF') {
		for (i = 0; i < tmp.size(); i++) {
			if ('A' <= tmp[i] && tmp[i] <= 'Z')
				tmp[i] = tmp[i] + 'a' - 'A';
		}

		for (i = 0; i < max; i++) {
			if (str[i] == tmp) {
				a[i]++;
				if (max_str < a[i]) {
					max_str = a[i];
					max_num = i;
				}
				if (tmp.size() > max_length)
					max_length = (int)tmp.size();
				break;
			}
		}
		if (i >= max) {
			str[i-1] = tmp;
			max++;
			a[i - 1]++;
			if (max_str < a[i-1]) {
				max_str = a[i - 1];
				max_num = i - 1;
			}
			if (tmp.size() > max_length)
				max_length = (int)tmp.size();
		}
	}
	cout << str[max_num] << endl;

	for (i = 0; i < max; i++) {
		if ((int)str[i].size() == max_length)
			cout << str[i] << endl;
	}
	return 0;
}

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

int main()
{	
	string s, t;
	map<string, int> p;

	while (cin >> s) {
		if (p.find(s) != p.end())
			p[s]++;
		else
			p[s] = 1;

		if (s.size() > t.size())
			t = s;
	}

	int m = 0;

	for (map<string, int>::iterator itr = p.begin(); itr != p.end(); itr++)
		m = max(m, itr->second);

	for (map<string, int>::iterator itr = p.begin(); itr != p.end(); itr++)
		if (itr->second == m)
			cout << itr->first << endl;

	cout << t << endl;

	return 0;
}

C++: #include<iostream>
using namespace std;
#include<cstdio>
#include<cstring>
#include<string>
int main(){
  char mozi[1001][33],lenm[33],hind[33];
  int len=0,i=0,mozisu,count,max=-1;
  while(scanf("%s",mozi[i])!=EOF){
    len=strlen(mozi[i]);
    for(int j=0;j<len;j++){
      if(mozi[i][j]>='A' && mozi[i][j]<='Z'){
	mozi[i][j]+='a'-'A';
      }
    }
    if(mozisu<len){
     mozisu=len;
      strcpy(lenm,mozi[i]);
    }
    ++i;
  }
  for(int j=0;j<i+1;j++){
    count=0;
    for(int k=j+1;k<i+1;k++){
      if(!strcmp(mozi[j],mozi[k])){
	count++;
      }
    }
    if(max<count){
      max=count;
      strcpy(hind,mozi[j]);
    }
  }
  cout<<hind<<" "<<lenm<<endl;
}

C++: #include <iostream>
#include <map>
#include <string>
using namespace std; map<string,int>RB;int main() {string T;while ((cin>>T)!=NULL) {for (int i=T.length()-1;i>=0;i--) if (T[i]<='Z') T[i]+=32;RB[T]++;}
map<string,int>::iterator it=RB.begin(),ot=it++;for (;it!=RB.end();it++) if ((it->second)>(ot->second)) ot=it;cout<<ot->first<<" ";it=RB.begin();ot=it++;for (;it!=RB.end();it++) if ((it->first).length()>(ot->first).length()) ot=it;cout<<ot->first<<endl;return 0;}