Go: package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	words := strings.Split(scanner.Text(), " ")
	wordMap := make(map[string]int)
	for _, v := range words {
		wordMap[v]++
	}
	key := ""
	value := -1
	l := -1
	word := ""
	for k, v := range wordMap {
		// fmt.Println(k, v)
		if value < v {
			key = k
			value = v
		}
		if l < len(k) {
			l = len(k)
			word = k
		}
	}

	fmt.Println(key, word)
	// fmt.Println(wordMap)
}

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

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

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

	while (cin >> s) {
		transform(s.begin(), s.end(), s.begin(), tolower);
		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<vector>
#include<list>
#include<iostream>
#include<string>
#include<string.h>
#include<unordered_map>
using namespace std;

int main() {
	string word;
	unordered_map<string, int> myhash;
	int maxLen = 0;
	string maxLenS;
	int maxCount = 0;
	string maxCountS;
	while (cin >> word) {
		if (word.length() > maxLen) {
			maxLen = word.length();
			maxLenS = word;
		}
		if (myhash.find(word) == myhash.end()) {
			myhash[word] = 1;
		}
		else {
			myhash[word]++;
		}
		if (myhash[word] > maxCount) {
			maxCount = myhash[word];
			maxCountS = word;
		}
	}
	cout << maxCountS << ' ' << maxLenS << endl;
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
    string s, t;
    getline(cin, s);
    map<string, int> m;
    istringstream is(s);
    while (is >> t) if (m.find(t) == m.end()) m[t] = 0; else m[t]++;

    vector<pair<int, string> > v1, v2;
    for (map<string, int>::iterator it = m.begin(); it != m.end(); ++it) {
        v1.push_back(make_pair(it->second, it->first));
        v2.push_back(make_pair(it->first.size(), it->first));
    }
    sort(v1.rbegin(), v1.rend());
    sort(v2.rbegin(), v2.rend());
    cout << v1[0].second << " " << v2[0].second << endl;

    return 0;
}