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 <set>
using namespace std;

int main(){
	multiset<string> se;
	string str,str2;
	while(cin>>str){
		se.insert(str);
	}

	int cnt=0,cnt2=0;
	for(auto it=se.begin();it!=se.end();it++){
		int tmp=se.count(*it);
		if(tmp>cnt){
			cnt=tmp;
			str=(*it);
		}
		int tmp2=(int)(*it).length();
		if(tmp2>cnt2){
			cnt2=tmp2;
			str2=(*it);
		}
	}
	cout<<str<<" "<<str2<<endl;
	return 0;
}

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

int main(void) {
    string a;
    map<string, int> data;

    while (cin >> a)
        ++data[a];

    int max_count = 0;
    string max_str = "";
    int max_len = 0;
    string max_len_str = "";

    for (auto itr = data.begin(); itr != data.end(); ++itr) {
        const pair<string, int>& hoge = *itr;
        if (hoge.second > max_count) {
            max_count = hoge.second;
            max_str = hoge.first;
        }
        if (hoge.first.length() > max_len) {
            max_len = hoge.first.length();
            max_len_str = hoge.first;
        }
    }

    cout << max_str << " " << max_len_str << endl;

    return 0;
}

C++: #include <algorithm>
#include <iostream>
#include <string>
#include <utility>
#include <map>
#define itr(it,a) for(auto it=(a).begin();it!=(a).end();++it)

typedef std::pair<int, std::string> P;

std::map<std::string, int> m;
P maF( 0, "" ), maL( 0, "" );

int main()
{
    std::string s;
    while( std::cin >> s )
    {
        ++m[s];
    
        maL = std::max( maL, P( s.size(), s ) );
    }

    itr( it, m )
        maF = std::max( maF, P( it->second, it->first ) );

    std::cout << maF.second << ' ' << maL.second << std::endl;

    return 0;
}

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

int main()
{
    string field;
    map<string, int> mp;
    string frequently_word;
    string max_num_word;
    int freq_count = 0;
    int max_letter_num = 0;

    while (cin >> field)
    {
        /* store the word which has the maximum number */
        if(field.size() > max_letter_num)
        {
            max_letter_num = field.size();
            max_num_word = field;
        }
        /* search the word from map */
        if(mp.count(field)) 
        {
            mp[field]++; 
        }
        else
        {
            mp[field] = 1;
        }
 
    }
    /* get the most frequently word */
    for(auto itr = mp.begin(); itr != mp.end(); ++itr)
    {
        if(itr->second > freq_count)
        {
            freq_count = itr->second;
            frequently_word = itr->first;
        }
    }
    cout << frequently_word << " " << max_num_word << endl;

    return 0;
}

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

int main(){
    map<string,int> sent;
    string freq,lngest="";
    size_t N=0;

    string word;
    while(cin>>word){
        ++sent[word];
        if(sent[word]>N){
            N=sent[word];
            freq=word;
        }
        lngest=(word.size()>lngest.size()?word:lngest);
    }
    cout<<freq<<" "<<lngest<<"\n";
}

C++: #include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){

    string s1 = "1", s2 = "2";
    map<string, int>cnt;
    for(string s;cin >> s;){
        cnt[s]++;
        if(cnt[s] > cnt[s1])s1 = s;
        if(s.size() > s2.size())s2 = s;
    }    
    cout << s1 << " " << s2 << endl;

    return 0;
}

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

int main(){
    map<string, int> word;
    string s;
    string outen;
    string outlen;
    int maxen;
    int maxlen;
    maxen = 0;
    maxlen = 0;
    while(cin >> s){
        if(word.find(s) != word.end()){
            word[s]++;
            if(word[s] > maxen){
                outen = s;
            }
        }else{
            word.insert(map<string, int>::value_type(s, 1));
            if(s.size() > maxlen){
                outlen = s;
            }
        }
    }
    cout << outen << endl << outlen << endl;
    return 0;
}

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

int main(){
	string st;
	map<string, int> cnt;
	string len_max, freq_max;
	int len = 0;
	while( cin >> st ){
		cnt[st]++;
		if(len < st.size()){
			len = st.size();
			len_max = st;
		}
		freq_max = (cnt[freq_max] < cnt[st]) ? st : freq_max;
	}
	cout << freq_max << " " << len_max << endl;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
int main(){
    char a[1100] = {0};
    scanf("%[^\n]",a);
    int cnt = 0;
    int mx = 0;
    int len[1100] = {0};
    string ans[1100];
    for(int i = 0,j = 0; i <= strlen(a); i++){
        if('a' <= a[i] && a[i] <= 'z' || 'A' <= a[i] && a[i] <= 'Z'){
            ans[cnt] += a[i];
            j++;
        }
        else{
            len[cnt] = j;
            cnt++;
            mx = max(mx,j);
            j = 0;
        }
    }
    string date;
    for(int i = 0; i < cnt; i++){
        if(len[i] == mx){
            date = ans[i];
            break;
        }
    }
    sort(ans,ans+cnt);
    fill(len,len+50,0);
    string mx_date = ans[0];
    ans[cnt] = ' ';
    mx = 0;
    for(int i = 1; i <= cnt; i++){
        if(mx_date == ans[i]){
            mx++;
        }
        else{
            mx_date = ans[i];
            len[i-1] = mx;
            mx = 0;
        }
    }
    for(int i = 0; i < cnt; i++){
        mx = max(mx,len[i]);
    }
    for(int i = 0; i < cnt; i++){
        if(len[i] == mx){
            cout << ans[i] << ' ' << date << endl;
            break;
        }
    }

    return 0;
}