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

int main()
{
	string s[1001],len_max,ans;
	map<string,int> count;
	int i = 0,count_max = 1;
	while(cin >> s[i])
	{
		if(len_max.size() < s[i].size())
		{
			len_max = s[i];		
		};
		count[s[i]]++;

		if(count[s[i]] > count_max)
		{
			count_max = count[s[i]];
			ans = s[i];
		}
		i++;
	}

	cout << ans <<  " " << len_max << endl;

	return 0;
}

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

int main(){
  string s[1000];
  int n=0;
  while(cin>>s[n]) n++;
  sort(s,s+n);
  int m,c;
  m=c=0;
  string t,ms,l;
  ms=t=s[0];
  for(int i=0;i<n;i++){
    if(t==s[i]) c++;
    else{
      if(c>m){
	m=c;
	ms=t;
      }
      c=1;
      t=s[i];
      if(t.length()>l.length()) l=t;
    }
  }
  ms=t;
  cout<<ms<<" "<<l<<endl;
  return 0;
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int const N = 1001;
int main(){
  char str[N][33];
  int num[N],i=0,max=0,l=0;
  while(cin >> str[i]){
    i++;
  }
  for(int j =0;j<i;j++){
    num[j] =0;
  }
  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 <iostream>
#include <map>
#include <string>
using namespace std;
int main()
{
	string s,max("");
	map<string,int> word;
	map<int,string> tmp;
	while(cin >> s)
	{
		if(s.size() > max.size())max=s;
		word[s]++;
	}
	map<string,int>::iterator it;
	for(it=word.begin();it!=word.end();it++)
	{
		tmp[(*it).second] = (*it).first;
	}
	cout << (*tmp.rbegin()).second << " "<< max << endl;
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <map>
using namespace std;

#define FOR(i,a,b) for(long long int i=(a);i<(b);i++)
#define REP(i,n) for(long long int i=0;i<(n);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI 3.14159265358479

typedef long long ll;
typedef vector<long long int> vi;
typedef vector<long long int>::iterator vit;

int main(){
	map<string, int>table;
	int c = 0;
	string s, f, l;
	size_t n = 0;
	while (cin >> s){
		table[s]++;
		if (table[s] > n){
			n = table[s];
			f = s;
		}
		if (s.size() > l.size()){
			l = s;
		}
	}
	cout << f << l << endl;
}

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

int main(){
  map<string,int> table;
  string word;
  int k1 = 0;
  int k2 = 0;
  string answer1;
  string answer2;
  while(cin >> word){
    table[word]+=1;
    if(table[word] > k1){
      k1 = table[word];
      answer1 = word;
    }
    int len = sizeof(word);
    if (len > k2){
      k2 = len;
      answer2 = word;
    }
  }
  cout << answer1 << answer2 << endl;
}

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

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 <unordered_map>

using namespace std;

unordered_map<string, int> table;

int main() {
  string word, frequent, longest;
  size_t N = 0; // size_t represents size in bytes of word (length)
  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;
}

C++: #include <iostream>
#include <cstring>
#include <cstdio> //fgets
using namespace std;

int main(){
	char str[1000];
	char word[33][33]={0};
	int longest=0;
	int check[33]={0};
	char *tmp;
	int freq=0;
	int count=0;
	int i,j;
	size_t len , prev;
	fgets(str , sizeof(str) , stdin);
		tmp=str;
		for(i=0 ; str[i]!='\0' ;i++){
			if(str[i]==' '){
				str[i]='\0';
				strcpy((char*)&word[count] , (const char*)tmp);
				tmp=str+i+1;
				count++;
			}
		}
		strcpy((char*)&word[count],(const char*)tmp);
		count++;
	for(i=0 ; i<count ; i++){
		for(j=i ; j<count ; j++){
			if(strcmp((const char*)&word[i] , (const char*)&word[j])==0){
				check[i]++;
			}
		}
	}
	for(i=0 ; i<count-1 ; i++){
		if(check[freq]<check[i+1]){
			freq=i+1;
		}
	}
		prev=strlen(word[0]);
	for (i=0 ; i<count ; i++){
		len=strlen(word[i]);
		if(len > prev){
			prev = len;
			longest=i;
		}	
	}
	cout << (char*)&(word[freq]) << " "<< (char*)&(word[longest]) << endl;
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#define MAX 100000
typedef long long int ll;

using namespace std;

map < string , int > mp;

struct node{
    char st[50];
}a[1005];

int main()
{
    freopen("in.txt","r",stdin);
    char s[10000],str[50];
    while(gets(s)){
        strcat(s," ");
        mp.clear();
        int len=strlen(s);
        int j=0;
        int k=0;
        for(int i=0;i<len;i++){
            if(s[i]==' '){
                str[j]='\0';
                mp[str]++;
                strcpy(a[k++].st,str);
                j=0;
            }
            else{
                str[j++]=s[i];
            }
        }
        int index1,index2,x=0,z=0;
        for(int i=0;i<k;i++){
            int s=strlen(a[i].st);
            if(s>x)x=s,index1=i;
            if(mp[a[i].st]>z)z=mp[a[i].st],index2=i;
        }
        printf("%s %s\n",a[index2].st,a[index1].st);
    }
    return 0;
}

C++: #include<iostream>
#include<cstring>
using namespace std;
struct word{
	int len;
	int num;
	char w[32];
};
int main(){
	word vo[1000];
	char vol[32];
	int k = 0,max[2]={0,0};
	while(cin>>vol){
		int i;
		for(i=0; i<k; i++){
			if(strcmp(vo[i].w,vol) == 0){
				vo[i].num++;
				break;
			}
		}
		if(i == k){
			strcpy(vo[k].w,vol);
			vo[k].num = 1;
			vo[k].len = strlen(vo[k].w);
			k++;
		}
	}
	for(int i=1; i<k; i++){
		if(vo[max[0]].len<vo[i].len){max[0] = i;}
		if(vo[max[1]].num<vo[i].num){max[1] = i;}
	}
	cout <<vo[max[1]].w<<" "<<vo[max[0]].w<<endl;
	return 0;
}

C++: #include<iostream>
#include<string>
#include<map>
int main(){std::map<string,int>m;string s,t,u;for(;cin>>s;s.length()>u.length()?u=s:u)++m[s]>m[t]?t=s:s;std::cout<<t<<" "<<u<<"\n";}

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

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

	string str;
	vector<string> v;
	while(cin >> str){
		transform(str.begin(), str.end(), str.begin(), ::tolower);

		v.push_back(str);

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