Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

type Pair struct {
	key   string
	value int
}

func main() {
	scanner.Split(bufio.ScanWords)
	counts := map[string]int{}
	maxLen := 0
	maxLenWord := ""
	for {
		word := nextString()
		if word == "" {
			break
		}

		counts[word]++

		if len(word) > maxLen {
			maxLen = len(word)
			maxLenWord = word
		}
	}

	mapPairs := []Pair{}
	for k, v := range counts {
		mapPairs = append(mapPairs, Pair{k, v})
	}
	sort.Slice(mapPairs, func(i, j int) bool { return mapPairs[i].value > mapPairs[j].value })

	fmt.Println(mapPairs[0].key, maxLenWord)
}

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

int main(){
    map<string,int>M;
    string in,ma,ma2;
    while(cin>>in){
        for(int i=0;i<in.size();i++)in[i]=tolower(in[i]);
        M[in]++;
        if(ma.size()<in.size())ma=in;
    }

    for(map<string,int>::iterator it=M.begin();it!=M.end();it++){
        ma2=it->first;
    }
    cout<<ma2<<" "<<ma<<endl;

    return 0;
}

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] += 1;
    if (table[word] > N) {
      N = table[word];
      frequent = word;
    }
    if (word.size() > longest.size()) longest = word;
  }
  cout << frequent << " " << longest;
}

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

using namespace std;

int main(){
	map<string,int> words;
	string most,max;
	char wd[33];
	while(cin>>wd){
		string temp(wd);
		if(words.count(temp)==0)
		words[temp]=1;
		else
		words[temp]++;
		if(words[most]<words[temp])
		most=temp;
		if(max.size()<temp.size())
		max=temp;
	}
	printf("%s %s\n",most.c_str(),max.c_str());
}

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

int main()
{
    string line;
    string field;
    map<string, int> mp;
    string frequently_word;
    string max_num_word;
    int freq_count = 0;
    int max_letter_num = 0;

    getline(cin, line);    
    istringstream stream(line);

    /* ??????????????????????????? */
    while (getline(stream, field, ' '))
    {
        /* ?????§????????°?????????????????? */
        if(field.size() > max_letter_num)
        {
            max_num_word = field;
        }
        /* ????????????????????°??????????????? */
        if(mp.count(field)) 
        {
            mp[field]++; 
        }
        else
        {
            mp[field] = 1;
        }
 
    }
    /* ??????????????????????????? */
    for(auto itr = mp.begin(); itr != mp.end(); ++itr)
    {
        if(itr->second > freq_count)
        {
            frequently_word = itr->first;
        }
    }
    cout << frequently_word << " " << max_num_word << endl;

    return 0;
}

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

using namespace std;

int main()
{
  string s[1001], ms, fs;
  int m, c;
  for (int i = 0, m = 0; (c = getchar()) != '\n'; i++){
      cin >> s[i];
      if(s[i].size() > m){
	m = s[i].size();
	ms = s[i];
      }
  }
  for(int i = 0, c = 0; i < 1001; i++){
    for(int j = i + 1; j < 1001; j++){
      if(s[i].compare(s[j]) == 0){
	int nc = 0;
	nc++;
	if(nc > c){
	  c = nc;
	  fs = s[i];
	}
      }
    }
  }
  cout << fs << " " << ms << endl;
  return 0;
}

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

int main(){
	int max = 0;
	string max_str;

	string str;
	vector<string> v;
	while(cin >> str){
		v.push_back(str);

		if(v.size() > max){
			max_str = str;
		}
	}
	sort(v.rbegin(), v.rend());
	cout << v[0] << endl;

	cout << max_str << endl;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define EXIST(v,i) (find(all(v), i) != (v).end())
#define ERASE(v,i) (v).erase(remove(all(v), i), (v).end())
#define INDEX(v,i) (find(all(v), i) - (v).begin())
#define rep(i,n) for(int i = 0; i < (int)n; ++i)
#define debug(x) cerr << #x << " = " << (x) << endl;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

const int INF = 100000000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;

int main() {
	map<string, int> m;
	string line;
	getline(cin, line);
	istringstream is(line);
	for(string word; is >> word;) {
		m[word]++;
	}
	int lmax = 0, cmax = 0;
	string wlmax = "", wcmax = "";
	for(map<string, int>::iterator it = m.begin(); it != m.end(); ++it) {
		if(static_cast<int>(it->first.length()) > lmax) {
			lmax = it->first.length();
			wlmax = it->first;
		}
		if(it->second > cmax) {
			cmax = it->second;
			wcmax = it->first;
		}
	}
	cout << wcmax + " " << wlmax << endl;
	return 0;
}

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

map <string, int> dic;

string lowerword(string word){
    for (int i=0; i<(int)word.size(); i++)
        word[i] = tolower(word[i]);
    return word;
}

int main(void){

	while (true){
		string s;
		cin>>s;
		if (cin.eof()) break;
		dic[lowerword(s)]++;
	}

	int l=0, m=0, tmp;
	string w1, w2;
	for (auto &x: dic){
		tmp = x.second;
		if (tmp>m){
			m = tmp;
			w1 = x.first;
		}
		tmp = x.first.size();
		if (tmp>l){
			l = tmp;
			w2 = x.first;
		}
	}
	cout<<w1<<" "<<w2<<endl;
	return 0;
}

C++: #include<stdio.h>
#include<string.h>
char str[33];
int lmax=0;
char mword[33];
typedef struct{
	char word[33];
	int time;
}data;
data d[1000];
int cd=0;
int i;
int main(){
	while(scanf("%s",str)!=EOF){
		if(strlen(str)>lmax){
			lmax=strlen(str);
			strcpy(mword,str);
		}
		for(i=0;i<cd;i++)if(strcmp(d[i].word,str)==0){
			d[i].time++;
			break;
		}
		if(i==cd){
			strcpy(d[cd].word,str);
			d[cd++].time=1;
		}
	}
	int fm=0;
	for(i=0;i<cd;i++)if(d[i].time>d[fm].time)fm=i;
	printf("%s %s\n",d[fm].word,mword);
}

C++: #include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
char a[1010][100];
char b[10000];
int main()
{
	int i,j,l,s,m,n,p,k,s1,s2;
	while(gets(b))
	{
		l=strlen(b);
		j=0;p=0;n=0;s=0;
		for(i=0;i<l;i++)
		{
			if(b[i]!=' ')
			{
				char t=b[i];
				a[j][p++]=b[i];
			}
			else
			{
			//	cout<<p<<" --"<<endl;
				if(p>n)
				{
					n=p;
					m=j;
				}
				j++;
				p=0;
			}
		}
          if(p>n)
				{
					n=p;
					m=j;
				}
		int t=0;
		for(i=0;i<=j;i++)
		{
			s=0;
			for(s1=0;s1<=j;s1++)
			{
				if(strcmp(a[i],a[s1])==0)
					s++;
			}
			if(s>t)
			{
				t=s;
				s2=i;
			}
		}
		cout<<a[s2]<<" "<<a[m]<<endl;
	}
}

C++: #include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
struct R{string word;
int nl;int ty;

};

int main(){

	struct R RR[1001]={};
	int i=0;
	string str;
	while(cin>>str){
		RR[i].word=str;RR[i].nl=str.size();RR[i].ty=0;
	i++;
	}
	
	for(int I=0;I<i;I++)
		for(int J=0;J<i;J++)
			if(RR[I].word==RR[J].word)RR[I].ty++;

	string x,y;
	int max1=0,max2=0;

	for(int I=0;I<i;I++)
	{//cout<<RR[I].ty<<endl;
		if(RR[I].nl>max1){x=RR[I].word;max1=RR[I].nl;}
		if(RR[I].ty>max2){y=RR[I].word;max2=RR[I].nl;}}

	cout<<y<<" "<<x<<endl;
return 0;

}