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<iostream>
#include<map>
#include<cstring>
#include<stack>

using namespace std;

int main(){
  int max_c = 0;
  map<string, int> cnt;
  stack<string> words;
  string word, freq, max_l;
  
  while(cin >> word) {
    if(word.length() > max_l.length()) max_l = word;
    if(cnt[word] == 0) words.push(word);
    cnt[word]++;
  }
  
  while(!words.empty()){
    word = words.top();
    words.pop();
    if(max_c < cnt[word]) {
      max_c = cnt[word];
      freq = word;
    }
  }

  cout << freq << ' ' << max_l << endl;

  return 0;
}

C++: #include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

int main(){
	map<string,int> mp;
	string s;
	getline(cin,s);
	vector<string> sent;

	int len=s.size();




	string maxStr="";
	int maxNum=-1;

	string tmp="";
	rep(i,len){
		if(s[i]!=' '){
			tmp+=s[i];
		}
		else{
			mp[tmp]+=1;
			sent.pb(tmp);
			if(maxNum<(int)tmp.size()){
				sent.pb(tmp);
				maxStr=tmp;
				maxNum=tmp.size();
			}
			tmp="";
		}
	}
	mp[tmp]+=1;
	sent.pb(tmp);
	if(maxNum<(int)tmp.size()){
		sent.pb(tmp);
		maxStr=tmp;
		maxNum=tmp.size();
	}

	string str="";
	int num=-1;
	for(int i=0;i<sent.size();i++){
		if(num<mp[sent[i]]){
			str=sent[i];
			num=mp[sent[i]];
		}

	}
	cout<<str<<" "<<maxStr<<endl;


	return 0;
}

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

using namespace std;

int main(){
	string sent;
	string word[500];
	int a[500]={};
	int i,j,k,l;
	int n,m,len;
	i=0;
	while(cin>>sent){
		if(i==0){
			word[0]=sent;
			a[0]++;
			i++;
			len=sent.size();
			n=0;
		}
		else {
			if(len<sent.size()){
				len=sent.size();
				n=i;
			}
			for(j=0; j<i; j++){
				if(sent==word[j]){
					a[j]++;
					break;
				}
				if(j==i-1){
					word[i]=sent;
					a[i]++;
					i++;
					break;
				}
			}
		}
	}
	m=0;
	for(j=0; j<=i; j++){
		if(m<a[j])m=j;
	}
	cout<<word[m]<<" "<<word[n]<<endl;
	return 0;
}

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

using namespace std;

int main()
{
	map<string, int> counter;
	string longest;

	{
		string input;
		while(cin >> input)
		{
			if(longest.length() < input.length())
				longest = input;

			if(counter.find(input) == counter.end())
				counter[input] = 0;
			else
				counter[input]++;
		}
	}

	int frequency = 0;
	string word;
	for(auto i : counter)
		if(frequency < i.second)
		{
			frequency = i.second;
			word = i.first;
		}

	cout << word << ' ' << longest << endl;

	return 0;
}

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

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    int max_cnt = 0, cnt;
    std::string max_lenght_str = "";
    std::string max_cnt_str = "";
    std::string str;
    std::map<std::string, int> str2cnt;

    while (std::cin >> str) {
        std::transform(str.begin(), str.end(),
                       str.begin(), ::tolower);
        if (str.size() > max_lenght_str.size()) {
            max_lenght_str = str;
        }
        cnt = ++str2cnt[str];

        if (max_cnt < cnt) {
            max_cnt = cnt;
            max_cnt_str = str;
        }
    }

    std::cout << max_cnt_str << " " << max_lenght_str << std::endl;

    return 0;
}

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