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<stdio.h>
#include<string>
#include<iostream>
#include <ctype.h>




using namespace std;
struct ST{string str;int c;int z;};

int main(){

int i=0;
string str,sth,stl;
struct ST P[1001];
int max=0;
while(cin>>str){
	for(int  j=0;j<str.size();j++)
	str[j]=tolower(str[j]);
 
//	for(int j=0;j<str.size();j++)
//	str[i] = tolower( str[i] );

P[i].str=str;P[i].c=0;P[i].z=(int)str.size();
i++;
}
for(int j=0;j<i;j++)
for(int k=i-1;k>j;k--)
	if(P[k-1].str>P[k].str)
//if(P[k-1].str>P[k].str)
//if(strcmp(P[k-1].str,P[k].str)>0)
{


struct ST TEM=P[k-1];P[k-1]=P[k];P[k]=TEM;
//cout<<"*";
}

for(int j=1;j<i;j++)
{if(P[j-1].str==P[j].str)P[j].c++;

}
max=0;
for(int j=0;j<i;j++)
{if(max<P[j].c){max=P[j].c;sth=P[j].str;}}
max=0;
for(int j=0;j<i;j++)
	if(P[j].z>max){max=P[j].z;stl=P[j].str;}

cout<<sth<<" "<<stl<<endl;

//for(int j=0;j<i;j++)
//	cout<<P[j].str<<P[j].z<<endl;

return 0;
}

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

//#define PI 3.141592653589

using namespace std;


int main()
{
	map<string,int> table;
	string word, ans1, ans2;
	int freq=0, len=0;
	while (cin >> word)
	{
		if (table.find(word) == table.end())
		{
			table[word] = 1;
		} else {
			table[word]++;
		}
		if (table[word] > freq)
		{
			freq = table[word];
			ans1 = word;
		}
		if (word.size()>len)
		{
			len = word.size();
			ans2 = word;
		}
	}
	cout << ans1 << " " << ans2 << endl;
	
	return 0;
}

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=I+1;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;
	 if(RR[I].ty>max2)y=RR[I].word;}

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

}

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

map<string, int> d;

int main(){
  int max_n=0, max_len=0;
  string s, n_s, len_s;
  while(cin>>s){
    if(max_len<s.length()){
      len_s=s;
      max_len=s.length();
    }
    d[s]++;
    if(max_n<d[s]){
      n_s=s;
      max_n=d[s];
    }
  }
  cout<<n_s<<' '<<len_s<<endl;
  return 0;
}

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])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] << " " << maxs << endl;

  return 0;
}

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

int main() {
  std::string s;
  std::map<std::string, int> m;

  while (std::cin >> s) {
    decltype(m)::iterator it = m.find(s);

    if (it == m.end()) {
      m.insert(std::make_pair(s, 1));
    } else {
      it->second++;
    }
  }

  int mode = 0;
  decltype(m)::iterator modePair;
  int maxLen = 0;
  decltype(m)::iterator maxLenPair;

  for (decltype(m)::iterator i = m.begin(); i != m.end(); ++i) {
    if (mode < i->second) {
      mode = i->second;
      modePair = i;
    }

    if (maxLen < i->first.length()) {
      maxLen = i->first.length();
      maxLenPair = i;
    }
  }

  std::cout << modePair->first << " " << maxLenPair->first << std::endl;


  return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;
int main(){
string n,t;
int ms=0;
map<string,int>ta;
	while(cin>>n){
	ta[n]++;
	if( ms<n.size() )ms=n.size(),t=n;
	}
	string a;
	ms=0;
	for(map<string,int>::iterator it=ta.begin();it!=ta.end();it++){
		if(ms<(*it).second)ms=(*it).second,a=(*it).first;
	}
	
	cout<<a<<" "<<t<<endl;

	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
#include <string> 
#include <string.h>
#include <utility>
using namespace std;


int main(){
	string str;
	char word[35][35];
	int x=0,y=0,i=0,j,length=0,maxl=0,maxq[35],q,p=0;maxq[0]=0;
	getline(cin,str);
	while(1){
		if(str[i]==' '){
			word[y][x]='\0';
			x=0;
			y++;
		}
		else if(str[i]=='\0'){
			word[y][x]='\0';
			word[y+1][0]='\0';
			break;
		}
		else{
			word[y][x]=str[i];
			x++;
		}
		i++;
	}
	for(i=0;i<y;i++){
		for(j=0;j<y-i;j++){
			if(strcmp(word[j],word[j+1])>0){
				for(x=0;x<35;x++){
					swap(word[j][x],word[j+1][x]);
				}
			}
		}
	}
	for(i=0;i<=y;i++){
		for(j=0;word[i][j]!='\0';j++){}
		if(maxl<j){
			maxl=j;
			length=i;
		}
		if(strcmp(word[i],word[i+1])==0){
			maxq[i+1]=maxq[i]+1;
		}
		else{
			maxq[i+1]=0;
		}
	}
	for(i=0;i<=y;i++){
		if(p<maxq[i]){
			p=maxq[i];
			q=i;
		}
	}
	printf("%s %s\n",word[q],word[length]);
	return 0;
}

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

int main() {
    map<string,int> cnt;
    string s,ans1,ans2;
    int mx1=0,mx2=0;
    while (cin>>s) {
        cnt[s]++;
        if (cnt[s]>mx1) {
            mx1=cnt[s];
            ans1=s;
        }
        if (s.size()>mx2) {
            mx2=s.size();
            ans2=s;
        }
    }
    cout<<ans1<<' '<<ans2<<endl;
    return 0;
}

C++: #include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
 string s, max("");
 map<string, int> m;
 map<int, string> x;

 while(cin>>s){
  if(s.size() > max.size())
  max = s;
  m[s]++;
 }

 for(map<string, int>::iterator it = m.begin(); it != m.end(); it++){
  x[(*it).second] = (*it).first;
  cout<<(*it).first;
 }

 cout<<(*x.rbegin()).second<<" "<<max<<endl;
 return 0;
}

C++: #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define pb         push_back
#define mp         make_pair
#define ll         long long
#define PI         acos(-1.0)
#define ALL(A)     ((A).begin(), (A).end())
#define vsort(v)   sort(v.begin(),v.end())
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)


int main(){
    int i, j, times=0;
    string tmp,maxLength,maxTimes;
    map<string, int> sentences;
    maxLength="";
    while(cin>>tmp){
        if(tmp.length()>maxLength.length()){
            maxLength=tmp;
        }
        if(sentences.count(tmp)==0){
            sentences.insert(map<string,int>::value_type(tmp,1));
        }else{
            sentences[tmp]++;
        }
        if(sentences[tmp]>times){
            times=sentences[tmp];
            maxTimes=tmp;
        }
    }
    cout << maxTimes << " " << maxLength << endl;
}