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<cstring>
#include<stdio.h>
#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))
	{
		memset(a,0,sizeof(a));
		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;
			}
		}
		printf("%s %s\n", a[s2], a[m]);
	}
}

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

const int MAX_NUM_OF_STR = 1010;

int main(){
	int len = 0, tango = 0;
	string str[MAX_NUM_OF_STR], max, maxlen;
	map<string, int> string_cnt;
	
	while(cin >>str[tango]){
		string_cnt[str[tango]]++;
		
		if(str[tango].size() > (unsigned)len){
			len = str[tango].size();
			maxlen = str[tango];
		}
		tango++;
	}
	
	map<string, int>::iterator it = string_cnt.begin();
	int cnt = -1;
	string tmp;
	for(int i = 0 ; i < string_cnt.size(); it++, i++){
		if((*it).second > cnt){
			cnt = (*it).second;
			tmp = (*it).first;
		}
	}
	max = tmp;
	
	cout <<max <<" " <<maxlen <<endl;
	return 0;
}

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

using namespace std;

int main() {
	string k[100];
	int kk[100][2];
	string a;
	int n = 0;
	int judge;
	int maxa = 0;
	int maxb = 0;
	string aa,bb;

	while(cin >> a) {
		if (n == 0) {
			k[0] = a;
			kk[0][0] = 1;
			kk[0][1] = a.size();
		} else {
			judge = 0;
			for (int i = 0; i < n; i++) {
				if (k[i] == a) {
					kk[i][0]++;
					judge = 1;
					break;
				}
			}
			if (judge == 0) {
				k[n] = a;
				kk[n][0] = 1;
				kk[n][1] = a.size();
			} else {
				continue;
			}
		}
		n++;
		
	}

	for (int i = 0; i < n; i++) {
		if (kk[i][0] > maxa) {
			aa = k[i];
			maxa = kk[i][0];
		}
		if (kk[i][1] > maxb) {
			bb = k[i];
			maxb = kk[i][1];
		}
	}
	
	cout << aa <<  " " << bb << endl;

	return 0;
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int const N = 1001;
int main(){
  char str[N][50];
  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(strlen(str[l]) < strlen(str[j]))
      l = j;
  }
  cout <<  str[max] <<" "<< str[l] << endl;
}

C++: #include <string>
#include <vector>
#include <iostream>
#include <sstream>
#include <chrono>
  
typedef struct LettersInfo {
    std::string letters;
    unsigned int count;??°
} lettersInfo_s;
  
int main()
{
    std::string paramStr;
    std::getline(std::cin, paramStr);
  
    std::vector<lettersInfo_s*> lettersList;
  
    std::string letters;
    std::istringstream stream(paramStr);
  
    unsigned int maxLength = 0;
    std::string maxLengthStr;
  
    while (std::getline(stream, letters, ' ')) {
        unsigned int len = letters.size();
        if ( len != 0) {
            if ( maxLength < len ) {
                maxLengthStr = letters;
                maxLength = len;
            }
 
            unsigned int loopCount;
            for (loopCount = 0; loopCount < lettersList.size(); loopCount++) {
                if ( lettersList[loopCount]->letters == letters ) {
                    ++lettersList[loopCount]->count;
                    break;
                }
            }
 
            if (loopCount == lettersList.size()) {
                lettersInfo_s* plettersInfo = new lettersInfo_s();
                plettersInfo->letters = letters;
                ++plettersInfo->count;
                lettersList.push_back(plettersInfo);
            }
        }
    }
  
    unsigned int maxCount = 0;
    std::string maxCountStr;
    while( lettersList.size() > 0 ) {
 
        lettersInfo_s* plettersInfo = lettersList.back();
 
        unsigned int count = plettersInfo->count;
        if (maxCount < count) {
            maxCountStr = plettersInfo->letters;
            maxCount = count;
        }
        delete plettersInfo;
        lettersList.pop_back();
    }
  
    std::cout << maxCountStr << " " << maxLengthStr << std::endl;
  
    return 0;
}

C++: #define scanf_s scanf
#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 1001
#define MIN -100001
#define _MAX 100
int main(void)
{
	int x, max = 0, max_n = 0, cou = 0, word_num[MAX / 2] = { 0 }, m_i, m_j;
	string word[MAX / 2];
	char str[MAX];
	gets_s(str);
	for (int i = 0; str[i] != '\0'; ++i) {
		for (int j = 0; str[i] != ' '; ++j, ++i) {
			word[cou][j] = str[i];
		}
		++cou;
	}
	for (int i = 0; i < cou; ++i) {
		if ((unsigned)word[i].size() > max) {
			max = word[i].size(); m_i = i;
		}
		for (int j = 0; j < i; ++j) {
			if (word[i] == word[j]) {
				++word_num[j];
				if (word_num[j] > max_n) { max_n = word_num[j]; m_j = j; }
			}
		}
	}
	cout << word[m_i] << " " << word[m_j] << "\n";
}

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

int main(){
  string str,mn,ml;
  map<string,int> cnt;

  while( cin >> str ){
    int xx = ++cnt[str];
    if( xx > cnt[mn] ) mn = str;
    if( str.size() > ml.size()) ml = str;
  }
  cout << mn << " " << ml << endl;

  return 0;
}

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

int main(){
	string s, str1, str2;
	map<string, int> mp;
	while(cin >> s){
		mp[s]++;
		if(mp[s] > mp[str1])str1 = s;
		if(s.size() > str2.size())str2 = s;
	}
	cout << str1 << " " << str2 << endl;
	return 0; 
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <map>

using namespace std;

int main(){
  vector<string> tmpwords;
  map<string, int> words;
  string tmp;
  while(cin >> tmp){

    auto itr = words.find(tmp);
    if(itr!=words.end()){
      words[tmp]++;
    }
    else{
      words.insert( map<string, int>::value_type(tmp, 1));
    }

  }

  cout << "here" << endl;
  
  int max=0;
  string maxStr;
  int frequence=0;
  string freStr;
  for(auto itr=words.begin();itr != words.end(); ++itr){
    if(max < (itr->first.size())){
      max = (itr->first.size());
      maxStr = itr->first;
    }
    if(frequence < (itr->second)){
      frequence = itr->second;
      freStr = itr->first;
    }
  }

  cout << maxStr << " " << freStr << endl;
  
}

C++: #include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
	string s, max="";
	map<string, int> m;
	while(cin >> s) {
		if(s.size() > max.size()) {
			max = s;
		}
		m[s]++;
	}
	map<string, int>::reverse_iterator p = m.rbegin();
	cout << (*p).first << " " << max << endl;
}