Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	l := sc.Text()
	words := strings.Split(l, " ")

	frequency := map[string]int{}
	long := map[string]int{}
	var maxFrequency, longest int
	var frequentWord, longestWord string
	for _, w := range words {
		frequency[w]++
		long[w] = len(w)
		if frequency[w] > maxFrequency {
			maxFrequency = frequency[w]
			frequentWord = w
		}
		if len(w) > longest {
			longest = long[w]
			longestWord = w
		}
	}

	fmt.Println(frequentWord + " " + longestWord)
}

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

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

typedef pair<int,string> P;

int comp(const P& a, const P& b) {
	return (a.first > b.first);
}

int main() {
	vector<P> seq;
	string s;
	string maxstr = "";
	int pos;
	
	getline(cin, s);
	
	while (1) {
		pos = s.find(' ');
		string word = s.substr(0, pos);

		bool inserted = false;
		for (int i = 0; i < seq.size(); i++) {
			if (seq[i].second == word) {
				seq[i].first++;
				inserted = true;
			}
		}
		if (!inserted) {
			seq.push_back(P(1, word));
		}

		if (word.size() > maxstr.size()) {
			maxstr = word;
		}

		if (pos == string::npos)
			break;
		s = s.substr(pos+1);
	}

	sort(seq.begin(), seq.end(), comp);

	cout << seq[0].second << " " << maxstr << endl;

	return 0;
}