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 <string>
#include <vector>
#include <iostream>
#include <sstream>
#include <chrono>

// ???????????????????????°????????????????§???????
typedef struct LettersInfo {
    std::string letters; // ??????
    unsigned int count; // ???????????°
} lettersInfo_s;

int main()
{
    /////////////////
    // 1. ??\????????????
    /////////////////
    std::string paramStr;
    std::getline(std::cin, paramStr);

    // ???????¨???¬????§?
    //auto start = std::chrono::system_clock::now();

    // ???????????????????????°?????????
    std::vector<lettersInfo_s*> lettersList;

    // ?????????????????????????´???????
    std::string letters;
    std::istringstream stream(paramStr);

    // ?????????????????¨????????????????£????????´???????
    unsigned int maxLength = 0;
    std::string maxLengthStr;

    ////////////////////////////////////////////////////////////////////////
    // 2. ??????????????????????????????????????????????´¢???????????????????????????????????°???????????????
    ////////////////////////////////////////////////////////////////////////
    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);
            }
        }
    }

    ////////////////////////////////////////
    // 3. ???????????????????????°?????????????????????????´¢
    ////////////////////////////////////////
    unsigned int maxCount = lettersList[0]->count;
    std::string maxCountStr = lettersList[0]->letters;
    for (unsigned int i = 1; i < lettersList.size(); i++) {
        unsigned int count = lettersList[i]->count;
        if (maxCount < count) {
            // ????????????????£??????\?????????
            maxCountStr = lettersList[i]->letters;;
            maxCount = count;
        }
    }

    ///////////////////////////////
    // 4. ????????????????????????????????¨???
    ///////////////////////////////
    std::cout << maxCountStr << " " << maxLengthStr << std::endl;

    // ???????¨???¬??????
    //auto end = std::chrono::system_clock::now();
    //auto dur = end - start;

    // ??????????????¨???
    //auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(dur).count();
    //std::cout << msec << "[ms]" << std::endl;

    //std::getline(std::cin, paramStr);

    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
string S, T[1000], U; int sum, maxn; int k, p[1000];
int main() {
	getline(cin, S);
	S += ' ';
	for (int i = 0; i <= S.size(); i++) {
		if (S[i] == ' ') {
			if (maxn < T[sum].size()) {
				maxn = T[sum].size(); U = T[sum]; 
			}
			sum++;
		}
		else {
			T[sum] += S[i];
		}
	}
	for (int i = 0; i < sum; i++) {
		p[i] = i;
		for (int j = 0; j < i; j++) {
			if (T[i] == T[j]) {
				p[j] += 10000; break;
			}
		}
	}
	sort(p, p + sum);
	cout << T[p[sum - 1] % 10000] << ' ' << U;
	return 0;
}

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

using namespace std;

/** Problem0029 : English Sentence **/
int main()
{
	map<string, int> sentences;
	pair<string, int> t;
	string tmp, maxLength;
	maxLength="";
	
	while (cin >> tmp) {
		if (tmp.length() > maxLength.length())
			maxLength = tmp;
		
		if (sentences.count(tmp) == 0) {
			sentences.insert(map<string,int>::value_type(tmp, 1));
		} else {
			sentences[tmp]++;
		}
	}
	
	t = *max_element(sentences.begin(), sentences.end());
	cout << t.first << " " << maxLength << endl;
	
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    vector<string> s;
    string tmps;
    set<string> st;
    //int i = 0;
    size_t maxl = 0;
    while(cin >>tmps) {
        s.push_back(tmps);
        st.insert(tmps);
        //maxl = max(maxl, s.at(i).size());
        //i++;
        //cout << tmp;
    }
    
    int ans = 0, maxv = 0;
    string maxs ="";
    string maxL = "";
    for (auto ss : st) {
        int tmp = 0;
        rep(i, s.size()) {
            //int tmp = 0;
            if (ss == s.at(i)) {
                tmp++;
            }
        }
        if (maxv < tmp) {
            maxv = tmp;
            maxs = ss;
        }
        if (maxL.size() < ss.size()) {
            maxL = ss;
        }
    }

    cout << maxs << " " <<maxL << endl;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  map<string,int> a;
  string s,maxs,maxms;
  while(cin>>s){
    a[s]++;
    if(a[maxs]<a[s])maxs=s;
    if(maxms.size()<s.size()) maxms=s;
  }
  cout<<maxs<<' '<<maxms<<endl;
}

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

int main(){
  string s;
  string ansstr;
  string maxv;
  map<string, int> mp;
  while (cin >> s) {
    mp[s]++;
    maxv = mp.rbegin()->first;

    int maxstr = 0;
    for (auto x : mp) {
      if (x.first.size() >= maxstr) {
        maxstr = x.first.size();
        ansstr = x.first;
      }
    }
  }
  cout << maxv << " " << ansstr << endl;
  return 0;
}

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

int main(){
	// word[s] Å ¶ñsÌo»ñªÔÁÄ­é
	map<string, int> word;
	vector<string> v;
	string s;

	while( cin >> s ){
		v.push_back(s);
		
		//üÍµ½Pêª·ÅÉ é©T·
		if( word.count(s) ){
			word[s]++;
		}else{
			word[s] = 1;
		}
	}
	// ÅpoÌPêð²×é
	int mode=0;
	for(int i=0 ; i < v.size() ; i++ ){
		mode = max( mode , word[ v[i] ] );
	}
	for(int i=0 ; i < v.size() ; i++ ){
		if( mode == word[ v[i] ] ){
			cout << v[i];
		}
	}
	// Å·ÌPêðßé
	int length = 0;
	for(int i=0 ; i < v.size() ; i++ ){
		length = max( length , (int)v[i].size() );
	}
	for(int i=0 ; i < v.size() ; i++ ){
		if( length == v[i].size() ){
			cout << " " << v[i] << endl;
		}
	}
}

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

bool compare(const pair<string, int> T1, const pair<string, int> T2) {
	return T1.second < T2.second;
}

int main (void){

	string str,maxByLength("");
	//map<int,string> X; //¶Ì·³
	map<string,int> Y; //¶Ì
	//int mm;

	while (cin>>str){
		if (str.size()>maxByLength.size())	maxByLength=str;
		Y[str]++;
	}

	// string maxByCount("");
	// int cnt = 0;
	pair<string, int> maxCountPair = *max_element(Y.begin(), Y.end(), compare);

	// cout << (*Y.rbegin()).first << " " << maxByLength << endl;
	// cout << maxByCount << " " << maxByLength << endl;
	cout << maxCountPair.first << " " << maxByLength << endl;

	return 0;

}