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 <stdio.h>
#include <string.h>

#define MAX 512

int main(void){
	char words[MAX][33];
	int wcnt=0;
	int f[MAX], len[MAX];
	char word[33];
	int longest, mostf;
	
	while (scanf("%s", word)!=EOF){
		int wid=-1;
		for (int i=0; i<wcnt; i++){
			if (strcmp(word, words[i])==0){
				wid = i;
			}
		}
		if (wid==-1){
			strcpy(words[wcnt], word);
			len[wcnt] = strlen(word);
			f[wcnt] = 1;
			wcnt++;
		} else {
			f[wid]++;
		}
	}
	longest = mostf = 0;
	for (int i=0; i<wcnt; i++){
		if (len[longest] < len[i]) longest = i;
		if (f[mostf] < f[i]) mostf = i;
//		printf("%s: %d %d\n", words[i], f[i], len[i]);
	}
	printf("%s %s\n", words[mostf], words[longest]);
	
	return 0;
}

C++: #include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=9000000009;

signed main(){
  map<string,int> mp;
  string s;
  getline(cin,s);
  string maxsent="";
  vector<int> p;
  REP(i,s.size())if(s[i]==' ')p.PB(i);
  int h=0;
  for(int i=0;i<p.size()+1;i++){
    string t;
    t=s.substr(h,p[i]-h);
    h=p[i]+1;
    mp[t]++;
    if(maxsent.size()<t.size())maxsent=t;
  }
  string mostsent;
  int mode=0;
  for(auto x:mp){
    if(x.SC>mode){
      mode=x.SC;
      mostsent=x.FR;
    }
  }
  cout<<mostsent<<' '<<maxsent<<endl;
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <list>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <math.h>

using namespace std;


int main(){
	string input = ""; 
	map<string, int> dictionary;

	cin >> input;
	dictionary.insert(pair<string, int>(input, 1));
	string maxString = input;
	int maxCount = 1;


	while(cin >> input){
		for(map<string, int>::iterator it = dictionary.begin(); it != dictionary.end(); it++){
			if(input != it->first){
				dictionary.insert(pair<string, int>(input, 1));
				if(maxString.length() < input.length()){
					maxString = input;
				}
			}
			else{
				it->second++;
				if(maxCount < it->second){
					maxCount = it->second;
				}
			}
		}
	}

	for(map<string, int>::iterator it = dictionary.begin(); it != dictionary.end(); it++){
		if(it->second == maxCount){
			cout << it->first;
			break;
		}
	}

	cout << " " << maxString << endl;
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = (int)1e9;
const long long mod = 998244353LL;
const double pi = acos(-1.0);

//文字列分割
vector<string> split(string str, char del) {
	vector<string> re; string sub;
	for (char c : str) {
		if (c == del) re.push_back(sub), sub.clear();
		else sub += c;
	}
	re.push_back(sub);
	return re;
}

//小文字に変換
string StoLower(string s) {
	string ret;
	for (auto a : s)ret += tolower(a);
	return ret;
}

int main() {
	string S; getline(cin, S);
	VS S2 = split(S, ' ');
	VS s;
	for (auto aaa : S2) {
		s.pb(StoLower(aaa));
	}

	string a1, a2 = s[0];
	int c1 = -1;
	map<string, int> ma;
	for (auto aa : s) {
		ma[aa]++;
		if (sz(a2) < sz(aa))a2 = aa;
	}
	for (auto aa : ma) {
		if (c1 < aa.second) { c1 = aa.second; a1 = aa.first; }
	}
	cout << a1 << " " << a2 << endl;
}

C++: #include <iostream>
#include <string>
#include <map>
#include <algorithm>
#define MSI map<string,int>
#define MIS map<int,string,greater<int> >
using namespace std;
int main()
{
  string word;
  MSI msi;
  MIS mis;
  while(cin >> word){
    msi[word]++;
    mis[word.length()] = word;
  }
  int arise = 0;
  for(MSI::iterator it = msi.begin(); it != msi.end(); it++){
    if(arise < (*it).second) {
      arise = (*it).second;
      word = (*it).first;
    }
  }
  cout << word << " " << mis.begin()->second << endl;
  return 0;
}

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

typedef pair<int,string> Pis ;
#define f first
#define s second

vector<Pis> VC ;

int main(){
	
	string str,Astr ;
	getline( cin , str ) ;
	str += ' ' ;
	
	bool f = false ;
	string tmp ;
	tmp.erase();
	for( int i=0 ; i < str.size() ; i++ ){
		if( str[i] != ' ' ) tmp += str[i] ;
		else {
			for( int j=0 ; j<VC.size() ; j++ ){
				if( VC[j].s == tmp ){
					VC[j].f++;
					f = true ;
					break    ;
				}
			}
			if( f ) f = false ;
			else {
				VC.push_back( Pis(1,tmp) ) ;
				if( Astr.size() < tmp.size() ) Astr = tmp ;
			}
			tmp.erase();
		}
	}
	
	sort( VC.begin() , VC.end() );
	
	cout << VC[VC.size()-1].s << " " ;
	cout << Astr << endl ;
	
	return 0;
}

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

using namespace std;

int main(void){
	string s;
	int length=0,max=0;
	map<string,int> sen;
	vector<string> w;
	while(cin >>s){
		w.push_back(s);
		if(sen.find(s)!=sen.end()){
			sen[s]++;
		}else{
			sen.insert( pair<string, int>(s,1));
		}
	}
	map<string,int>::iterator p;
	for(p = sen.begin() ; p !=sen.end() ; p++){
		if( max < p->second) max = p->second;
	}
	for(p = sen.begin() ; p !=sen.end() ; p++){
		if( max == p->second){
			cout << p->first << " ";
			break;
		}
	}
	for(int i=0 ; i<w.size() ; i++){
		if( length < w[i].size() ) length = w[i].size();
	}
	for(int i=0 ; i<w.size() ; i++){
		if( length==w[i].size() ){
			cout << w[i] << endl;
			break;
		}
	}
    return 0;
}

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

int main(){
  string s, maxLenS, maxCntS;
  int maxLen = 0, maxCnt = 0;
  map<string,int> cnt;

  while(cin >> s){
    if(s.size() > maxLen){
      maxLen = s.size();
      maxLenS = s;
    }

    cnt[s]++;

    if(cnt[s] > maxCnt){
      maxCnt = cnt[s];
      maxCntS = s;
    }
  }

  cout << maxCntS << " " << maxLenS << endl;
}