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 <vector>
#include <map>

using namespace std;

vector<string> split(string str, const char ch) {
	vector<string> res;
	string s = "";
	for (int i = 0; i < str.length(); i++) {
		if (str[i] == ch) {
			res.push_back(s);
			s = "";
		}else{
			s += str[i];
		}
	}
	res.push_back(s);
	return res;
}

int main() {
	string source;
	getline(cin, source);
	
	string maxl = "", mode = "";
	int max = 0;
	vector<string> str = split(source, ' ');
	map<string, int> m;
	
	for (int i = 0; i < str.size(); i++) {
		if (m[str[i]] == 0) {
			m[str[i]] = 1;

			if (str[i].length() > maxl.length()) {
				maxl = str[i];
			}
		}else{
			m[str[i]]++;

			if (m[str[i]] > max) {
				max = m[str[i]];
				mode = str[i];
			}
		}
	}
	cout << mode << " " << maxl << endl;
	return 0;
}

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

#define MAX(x,y) ((x,y)? x:y)

using namespace std;

string date[1000];

int main()
{
	for(int i=0;!cin.eof();i++){
		cin>>date[i];
	}
	sort(date,date+1000);
	int weitline=0;
	int maxline=0;
	string str;
	int str_i=0;
	for(int i=0;i<1000;i++)
	{
		if(str==date[i])str_i++;
		else 
		{
			str_i=1;
			str=date[i];
		}
		weitline =MAX(weitline,str_i);
		maxline=MAX(maxline,date[i].length());
	}
	string weitanswer;
	string maxanswer;

	for(int i=0;i<1000;i++)
	{
		if(str==date[i])str_i++;
		else 
		{
			str_i=1;
			str=date[i];
		}
		if(str_i==weitline)weitanswer=date[i];
		if(maxline==date[i].length()) maxanswer=date[i];
	}
	printf("%s %s\n");
	return 0;
}

C++: #include<iostream>
#include<cstring>
#include<string>
#define MAX 1060
using namespace std;
typedef struct{
	char s[MAX];
	int sum;
} gg;
char mstr[MAX],lstr[MAX],str[MAX],pre[MAX];
int lon=0,r,gs=0,mx=0;
gg sp[MAX];
void func(int x){
	int i;
	for(i=0;i<gs;i++){
		if(strncmp(sp[i].s,&str[x],r)==0){
			sp[i].sum++;
			break;
		}
	}
	if(i==gs){
		strncpy(sp[gs].s,&str[x],r);
		sp[gs++].sum=1;
	}
	if(sp[i].sum>mx){
		mx=sp[i].sum;
		strcpy(mstr,sp[i].s);
	}
}
int lo(int x){
	int i,k=0;
	for(i=x;isalpha(str[i]);i++)
		pre[k++]=str[i];
		return i-x;
}
void solve(){
	for(int i=0;str[i]!='\0';i++){
		if(isalpha(str[i])){
			r=lo(i);
			if(r>lon){
				lon=r;
				strcpy(lstr,&str[i]);
			}
			func(i);
			i+=(r-1);
		}
	}
}
int main(){
	while(cin.getline(str,MAX)){
		gs=0;mx=0;lon=0;
		solve();
		cout<<mstr<<' '<<lstr<<endl;
	}
	return 0;
}

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

using namespace std;

int main() {
	map<string, int> words;
	string word;
	int longest = 0, aliance = 0;
	while (cin >> word) {
		if (words.find(word) == words.end()) {
			int len = word.size();
			words[word] = 1;
			longest = max(longest, len);
		} else {
			int n = words[word];
			words[word] = n + 1;
		}
	}
	map<string, int>::iterator it;
	for (it = words.begin(); it != words.end(); it++)
		aliance = max(aliance, it->second);
	for (it = words.begin(); it != words.end(); it++)
		if (it->second == aliance) {
			cout << it->first;
			break;
		}
	for (it = words.begin(); it != words.end(); it++) {
		string s = it->first;
		if (s.size() == longest) {
			cout << " " << s << endl;
		}
	}

	return 0;
}

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

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

C++: #include <fstream>
#include <sstream>
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <utility>
#include <algorithm>
using namespace std;

vector<string> split(const string &str, char delim){
  istringstream iss(str); string tmp; vector<string> res;
  while(getline(iss, tmp, delim)) res.push_back(tmp);
  return res;
}

int main() {
  string snt;
  getline(cin, snt);

  vector<string> words = split(snt, ' ');
  words[0][0] = tolower( words[0][0] );

  // for (int i = 0; i < words.size(); i++)
  //   cout << words[i] << endl;

  map<string, int> cnt;

  int M = words.size();
  int l;
  int mx_len = 0;
  for (int i = 0; i < M; i++) {
    // 最頻値
    if (cnt.count(words[i])) {
      cnt[ words[i] ]++;
    } else {
      cnt[ words[i] ] = 0;
    }
    // 最大長さの単語
    if (words[i].length() > mx_len) {
      mx_len = words[i].length();
      l = i;
    }
  }

  int f;
  int mx_f = 0;
  for (int i = 0; i < M; i++) {
    if (mx_f < cnt[ words[i] ]) {
      f = i;
      mx_f = cnt[ words[i] ];
    }
  }

  cout << words[f] << " " << words[l] << endl;
}

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

#define pb         push_back
#define mp         make_pair
#define ll         long long
#define PI         acos(-1.0)
#define ALL(A)     ((A).begin(), (A).end())
#define vsort(v)   sort(v.begin(),v.end())
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)


int main(){
    int i, j, lmax=0, lind=0, nmax=0, nind=0, cnt=0, vsize;
    string s,vv;
    vector<string> v;
    while(cin>>s!=EOF){
        v.pb(s);
    }
    for(i=0;i<int(v.size());i++){
        cnt=0;
        vv=v[i];
        for(j=0;j<int(vv.size());j++){
            if(v[i]==v[j]){
                cnt++;
            }
        }
        if(nmax<cnt){
            nmax=max(cnt,nmax);
            nind=i;
        }
        if(lmax<int(vv.size())){
            lmax=max(lmax,int(vv.size()));
            lind=i;
        }
    }
    cout << v[lind] << v[nind] << endl;
}

C++: #include <iostream>
#include <map>
#include <string>
#include <utility>
using namespace std;
int main() {
  map<string, int> word;
  string s, s1 = "", s2 = "";
  int a = 0;
  while (cin >> s)
    word[s]++;
  for (auto e : word) {
    if (a < e.second) s1 = e.first;
    if (s2.size() < e.first.size()) s2 = e.first;
  }
  cout << s1 << ' ' << s2 << endl;
  return 0;
}

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

using namespace std;

typedef map<string, int> freqmap;

freqmap fm;

int main() {
    string word;
    while (cin >> word) {
        fm[word]++;
    }

    string most_used;
    int most_used_i = 0;
    for (freqmap::iterator i = fm.begin(); i!= fm.end(); i++) {
        if (most_used_i < (*i).second) {
            most_used_i = (*i).second;
            most_used = (*i).first;
        }
    }
    cout << most_used << ' ';
    
    string max_length;
    int max_length_i = 0;
    for (freqmap::iterator j = fm.begin(); j != fm.end(); j++) {
        if (max_length_i < (*j).first.length()) {
            max_length = (*j).first;
            max_length_i = (*j).first.length();
        }
    }
    cout << max_length << endl;
    return 0;
}