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<string>
#include<algorithm>	
#include<cmath>
#include<map>
#include<vector>
#define int long long
using namespace std;
int uiop[123456];
string test[123456];
signed main() {
	int n, b = 0, sum = 0, ans = 0; string s, t = "a", u = "a";
	for (int h = 0; h < 8; h++) {
		cin >> s; if (ans < s.size()) { ans = s.size(); t = s; }
		int a = 0;
		for (int i = 0; i < b; i++) {
			if (test[i] == s) {
				uiop[i]++; a++;
			}
		}
		if (a == 0) {
			test[b] = s; uiop[b]++; b++;
		}
	}
	for (int h = 0; h < b; h++) {
		sum = max(sum, uiop[h]);
	}
	for (int h = 0; h < b; h++) {
		if (uiop[h] == sum) {
			u = test[h];
		}
	}
	cout << u << ' ' << t << endl;
}

C++: #include <bits/stdc++.h>

using namespace std;

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

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

int main()
{
	string s;
	string maxLenS = "";
	map<string, int> m;
	vector<string> v;
	while (cin >> s)
	{
		if (maxLenS.size() < s.size())
		{
			maxLenS = s;
		}
		if (m.find(s) == m.end())
		{
			m[s] = 0;
			v.push_back(s);
		}
		else
		{
			m[s]++;
		}
	}
	int maxIndex = 0;
	for (int i = 0; i < v.size(); i++)
	{
		if (m[v[i]] > m[v[maxIndex]])
		{
			maxIndex = i;
		}
	}
	cout << v[maxIndex] << " " << maxLenS << endl;
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
    long saidai=0;
    char f;
    int a=0,cnt=0,num=0,max=0;
    string str,tango[1000]={""},answer,ans;
    getline(cin,str);
    for(int i=0;i<str.size();i++){
        if(str[i]==' '){
            for(int j=a;j<i;j++){
                if(isupper(str[j])){
                    f=str[j];
                    f=f+32;
                    str[j]=f;
                }
                tango[cnt]+=str[j];
            }
            cnt=cnt+1;
            a=i+1;
        }
    }
    for(int p=a;p<str.size();p++){
        tango[cnt]+=str[p];
    }
    
    for(int k=0;k<1000;k++){
        if((tango[k]==""))break;
        if(saidai<tango[k].size()){
            saidai=tango[k].size();
            ans=tango[k];
        }
    }
    
    for(int s=0;s<=cnt;s++){
        for(int t=s+1;t<=cnt;t++){
            if(tango[s]==tango[t]){
                num=num+1;
            }
        }
        if(max<num){
            max=num;
            answer=tango[s];
        }
    }
    cout<<answer<<" "<<ans<<endl;
    return 0;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#include<map>
#include<set>
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	map<string, int>a;
	int len = 0, freq = 0;
	string s;
	while (cin>>s) {
		a[s]++;
		if (len < s.length())len = s.length();
		if (freq < a[s])freq = a[s];
	}
	for (auto it = a.begin(); it != a.end(); it++) {
		if (freq == it->second)cout << it->first << " ";
	}
	for (map<string, int>::iterator it = a.begin(); it != a.end(); it++) {
		if (len == it->first.length())cout << it->first << endl;
	}
	return 0;
}

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

int main() {
  string s;
  vector<string> s_list;
  map<string, int> s_map;
  while (cin >> s) {
    s_map[s]++;
    s_list.push_back(s);
  }
  int max_s = 0;
  int i;
  for (i = 0; i < s_list.size(); i++) {
    max_s = max(max_s, s_map[s_list[i]]);
  }
  for (i = 0; i < s_list.size(); i++) {
    if (s_map[s_list[i]] == max_s) {
      cout << s_list[i] << ' ';
      break;
    }
  }
  int max_length = 0;
  for (i = 0; i < s_list.size(); i++) {
    max_length = max(max_length, (int)(s_list[i].length()));
  }
  for (i = 0; i < s_list.size(); i++) {
    if (max_length == s_list[i].length()) {
      cout << s_list[i] << endl;
      break;
    }
  }
  return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <cctype>
#include <cstdlib>
#include <string.h>
#include <utility>
#include <cstdio>
#include <set>
#include <map>
#include <boost/multiprecision/cpp_int.hpp>
#include <assert.h>
using namespace std;
namespace mp = boost::multiprecision;

#define INF (1 << 20)
#define EPS (1e-10)
#define EQ(a,b) (fabs((a)-(b)) < EPS)

#define ll long long
#define LL long long

int main() {
	string s;
	map<string, int> n;
	int maxl = 0;
	string maxls;
	while (cin >> s) {
		transform(s.begin(), s.end(), s.begin(), (int (*)(int))tolower);
		if (s.length() > maxl) {
			maxl = s.length();
			maxls = s;
		}
		auto res = n.find(s);
		if (res == n.end()) n.insert(make_pair(s, 1));
		else res->second++;
	}
	int maxn = 0;
	string maxns;
	for_each(n.begin(), n.end(), [&](pair<string, int> p) {
			if (p.second > maxn) {
			maxn = p.second;
			maxns = p.first;
			}
			});
	cout << maxns << ' ' << maxls << endl;
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
vector<string> st;
map<string,int> stm;
main(){
  char hoge[1001];
  string str;
  fgets(hoge,sizeof(hoge),stdin);
  str=hoge;
  int stp=0;
  int n=str.size();
  for(int i=0;i<n;i++){
    if(str.at(i)==' '){
      st.push_back(str.substr(stp,i-stp));
      stp=i+1;
      stm[st.back()]++;
    }
  }
  st.push_back(str.substr(stp,n-stp-1));

  int m=st.size();

  string strmax;
  string stres;
  int count=0;
  int tc=0;
  for(int i=0;i<m;i++){
    if(i==0){
      strmax=st[0];
      stres=st[0];

    }else{
      if(strmax.size() < st[i].size()){
	strmax=st[i];
      } 
      if(stm[st[i]] > stm[stres]){
	stres=st[i];
      }
    }
    
  } 
  cout << stres <<" "<<strmax<<endl;
}

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

int main() {
    string s;
    map<string, int> m;
    while(cin >> s) {
        m[s]++;
    }
    string r1, r2;
    for(auto& p : m) {
        if(m[r1] < p.second) {
            r1 = p.first;
        }
        if(r2.size() < p.first.size()) {
            r2 = p.first;
        }
    }
    cout << r1 << ' ' << r2 << endl;
}