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<string>

std::map<std::string,int> m;

int main()
{
	std::string s;
	std::getline( std::cin, s );
	
	int b = 0, e = 0;
	
	for( int i = 0; i < s.size(); i++ ){
		if( s[i] != ' ' ) e++;
		else{
			std::string s2 = s.substr( b, e - b );
			b = ++e;
			e = b;
			
		 	if( m.find( s2 ) != m.end() ){
				m.find( s2 )->second++;
			}
			else{
			 	m.insert( std::make_pair<std::string,int>( s2, 1 ) );
			}
		}
	}
	
	std::string s2 = s.substr( b, e - b + 1 );
	if( m.find( s2 ) != m.end() ){
		m.find( s2 )->second++;
	}
	else{
	 	m.insert( std::make_pair<std::string,int>( s2, 1 ) );
	}
	
	int len = 0, count = 0;
	for( std::map<std::string,int>::iterator it = m.begin(); it != m.end(); it++ ){
		count = std::max( count, it->second );
		len = std::max( len, (int)it->first.size() );
	}
	
	for( std::map<std::string,int>::iterator it = m.begin(); it != m.end(); it++ ){
		if( count == it->second ){
			std::cout << it->first << " ";
		}
	}
	for( std::map<std::string,int>::iterator it = m.begin(); it != m.end(); it++ ){
		if( len == it->first.size() ){
			std::cout << it->first;
		}
	}
	
 	return 0;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<list>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<map>
#include<queue>
#include<vector>
using namespace std;

int main() {
	map<string, int> a;
	int f = 0, l = 0;
	string s, t;
	for (string b; cin >> b;) {
		if (f < ++a[b]) {
			s = b;
			f = a[b];
		}
		if (l < b.size()) {
			t = b;
			l = b.size();
		}
	}
	cout << s << " " << t << endl;
	return 0;
}

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

using namespace std;

int main(){
	char num[100], damy[100], damy2[100];
	char now;
	string ans;
	int n, i, j, lng, cut = 0, l_damy;
	while(1){

		cin >> n;
		if(n == 0) break;
		cin >> num;


		for(i = 0; i < n; i ++){
			lng = strlen(num);
			now = num[0];
			for(j = 0; j < lng; j++){
				if(now == num[j]){
					cut ++;
					now = num[j];
				}
				else{
				}
			}

			ans = damy;
			l_damy = strlen(damy);
			for(j = 0; j < l_damy; j ++){
				num[j] = damy[j];
			}
		}
		cout << ans << endl;
	}

	return 0;
}

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

using namespace std;

int main()
{
    string input;
    string first, second;
    int max_freq = 0;
    map<string, int> data;

    cin >> input;
    first = second = input;

    while (cin >> input) {
        if (input.size() > second.size())
            second = input;

        data[input]++;

        if (data[input] > max_freq) {
            first = input;
            max_freq = data[input];
        }
    }

    cout << first << " " << second << endl;

    return 0;
}

C++: #include<stdio.h>
#include<string.h>
#define Maxn 1005
char s[Maxn / 4][33], a[33];
int f[Maxn / 4];
int main () {
	int t = 0, i, j, flag = 1, ff = 1;
	while (scanf("%s", a) != EOF) {
		memset(f, 0, sizeof(f));
		int max = 0, len = strlen(a);
		t++;
		if (len > max) {
			max = len;
			flag = t;
		}
		strcpy(s[t], a);
		f[t]++;
	}
	for (i = 1; i <= t; i++) {
		for (j = i; j <= t; j++) {
			if (!strcmp(s[i], s[j]))
				f[j]++;
		}
	}
	int Max = 0, flag2 = 1;
	for (i = 1; i <= t; i++) {
		if (f[i] > Max) {
			Max = f[i];
			flag2 = i;
		}
	}
	printf("%s %s\n", s[flag], s[flag2]);
	return 0;
}

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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

//Zeller's conguence

int main()
{
    int maxSize = 0;
    int maxNum = 0;
    string maxStr ;
    string maxNumString ;
    string input;
    map<string, int> m;
    while (cin >> input)
    {
        if (maxSize < input.length())
        {
            maxSize = input.length();
            maxStr = input;
        }
        if (m[input] == 0)
            m[input] = 1;
        else
            m[input]++;

        if (maxNum < m[input])
        {
            maxNum = m[input];
            maxNumString = input;
        }
    }
    cout << maxNumString << " " << maxStr << endl;
    return 0;
}

C++: #include <iostream>
#include <string>
 
using namespace std;
 
int main(void){
    int i,j,k=0,l;
    int f=0;
    string str;
    string max="\0";
    int count[100]={0};
    string count_str[100];
    int count_max=0;
     
    while(cin>>str){
        if(max.size()<str.size()){
            max=str;
        }
        for(i=0;i<k;i++){
            if(count_str[i]==str){
                count[i]++;
                f=1;
                break;
            }
        }
        if(f==0){
            count_str[k]=str;
            k++;
        }
    }
     
    for(i=0;i<k;i++){
        if(count[count_max]<=count[i]){
            count_max=i;
        }
    }
    cout<<count_str[count_max]<<" "<<max<<endl;
    return(0);
}

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

int main(){
	map<string, int> all;
	string buf;
	int maxlength = 0;
	string maxstring;
	while(cin>>buf){
		if(!all.count(buf)){
			all.insert( map<string, int>::value_type(buf, 1) );
			if(maxlength < buf.size()){
				maxlength = buf.size();
				maxstring = buf;
			}
		} else {
			all[buf]++;
		}
	}
	auto it = all.begin();
	int maxf = 0;
	string maxsf;
	while( it != all.end() )
	{
		if(maxf < (*it).second){
			maxf = (*it).second;
			maxsf = (*it).first;
		}
		++it;
	}
	cout<<maxsf<<" "<<maxstring<<endl;
	return 0;
}

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();
			}
		}
		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 <string>
#include <map>
using namespace std;

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

C++: #include <iostream>
#include <map>
int main()
{
	std::map<std::string, int> words;	
	std::string  input, longest, frequent;
	while (std::cin >> input) {
		words[input]++; // 出現頻度++
		if (words[input] > words[frequent]) { // 最出現頻度単語更新
			frequent = input;
		}
		if (input.length() > longest.length()) {
			longest = input;
		}
	}
	std::cout << frequent << ' ' << longest << std::endl;
}