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 <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>

using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

int dx[]={-1,1,0,0};
int dy[]={0,0,-1,1};

vector<string> split(const string& s, char c = ' '){
	vector<string> ret;
	string t; 
	stringstream ss(s);
	while(getline(ss, t, c)){
		ret.pb(t);
	}
	return ret;
}

int main(){
	string s;
	getline(cin,s);
	map<string, int> mp;
	vector<string> v = split(s);
	rep(i, v.size()){
		mp[v[i]]++;
	}
	string m, l;
	int a = 0;
	for(auto p : mp){
		if(a < p.se) m = p.fi, a = p.se;
		if(l.size() < p.fi.size()) l = p.fi;
	}
	cout<<m<<" "<<l<<endl;
}

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

int main() {
	//??£?¨?
	int most_views = 0,views=0,most_long=0,len=0;
	char tmp_sentence[1000];
	string sentence,mo_ma_word,longest_word,word="";
	vector<string> words;

	cin.getline(tmp_sentence, sizeof(tmp_sentence));
	sentence = tmp_sentence;
	for (int i = 0; i < sentence.size(); i++) {
		if (sentence[i] == ' ') { words.push_back(word); word = ""; }
		else word = word + sentence[i];
	}
	words.push_back(word);
	for (int i = 0; i < words.size(); i++) {
		for (int j = 0; j < words.size(); j++) {
			if (words[i] == words[j])views++;
		}
		if (most_views < views) {
			most_views = views;
			mo_ma_word = words[i];
		}
		views = 0;
	}
	for (int i = 0; i < words.size(); i++) {
		if (most_long < words[i].size())longest_word = words[i];
	}
	cout << mo_ma_word <<' '<<longest_word;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <cstring>
#include <functional>

using namespace std;

#define REP(i,a,b) for((i)=(a);(i)<(int)(b);(i)++)
#define rep(i,n) REP(i,0,n)
// BEGIN CUT HERE
#define foreach(itr,c) for(typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
// END CUT HERE

int main(){
  int i, mlen = 0, mdeta = 0, deta = 0, len = 0, leni,j, detai;
  string str;
  vector<string> data;

  while(cin >> str) data.push_back(str);

  rep(i,data.size()){
    deta = 0;
    rep(j,data.size()){
      if(data[i] == data[j]) deta++;
      len = data[i].size();
      if(mlen < len){
        mlen = len;
        leni = i;
      }
      if(mdeta < deta){
        mdeta = deta;
        detai = i;
      }
    }
  }

  cout << data[detai] << " " << data[leni] << endl;

  return 0;
}

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

using namespace std;

int maxlen = 0, mode = 0;
map<string,int> mp;

int main()
{   
    string len_key, mode_key, s2;
    int m = 9;
    while( cin >> s2 )
    {
        mp[s2]++;
        if( mode < mp[s2] )
        {
            mode = mp[s2];
            mode_key = s2;
        }
        if( maxlen < s2.size() )
        {
            maxlen = s2.size();
            len_key = s2; 
        } 
    }

    cout << mode_key << ' ' << len_key << '\n';
    return 0;
}

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

int main(){
	int max = 0;
	string max_str;

	string str;
	vector<string> v;
	while(cin >> str){
		transform(str.begin(), str.end(), str.begin(), ::tolower);

		v.push_back(str);

		if(str.length() > max){
			max_str = str;
		}
	}
	sort(v.rbegin(), v.rend());
	cout << v[0] << " " << max_str << endl;
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    map<string, int> m;
    int maxNum = 0;
    string ret1;
    int maxLength = 0;
    string ret2;

    for(;;){
        string s;
        if(!(cin >> s))
            break;

        int num = ++ m[s];
        if(num > maxNum){
            maxNum = num;
            ret1 = s;
        }

        if(s.size() > maxLength){
            maxLength = s.size();
            ret2 = s;
        }
    }

    cout << ret1 << ' ' << ret2 << endl;
    return 0;
}

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

int main(){
	map<string,int> data;
	string ans1,ans2,str;
	while(cin >> str){
		data[str]++;
		if(data[ans1] < data[str]) ans1 = str;
		if(ans2.size() < str.size() ) ans2 = str;
	}
	cout << ans1 << " " << ans2 << endl;
}

C++: #if 0

#endif

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

map<string, int> M;

int main() {
  string word, long_word, freq_word;
  int cnt = 0, length = 0;
  while (cin >> word) {
    if (M.count(word))
      M[word]++;
    else
      M[word] = 1;
    if (M[word] > cnt) {
      cnt = M[word];
      freq_word = word;
    }
    if (word.length() > length) {
      length = word.length();
      long_word = word;
    }
  }
  cout << freq_word << ' ' << long_word << endl;
}

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

using namespace std;

int main(void){

	string str[1010];
	int num[1010]={0};
	char inp[41];
	int max=0,max2=0;
	while(scanf("%s",&inp)!=EOF){
		for(int i=0;;i++){
			if(str[i].empty()==1){
				str[i]=inp;
				num[i]++;
				break;
			}
			if(str[i]==inp){
				num[i]++;
				break;
			}
		}
	}

		for(int i=1;!str[i].empty();i++){
			if(str[max].size()<str[i].size()) max=i;
			if(num[max2]<num[i]) max2=i;
		}
	cout<<str[max2]<<" "<<str[max]<<endl;

	return 0;
}

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

map <string, int> S;

int max_len,  max_time;
char str[TT], tmp_max_len[TT], tmp_max_time[TT];

void init(){
	max_len = 0,  max_time = 0;
}

void solve(){
	S[str] ++;
	if (max_time < S[str]){
		strcpy(tmp_max_time, str);
		max_time = S[str];
	}
	int len = strlen(str);
	if (max_len < len){
		strcpy(tmp_max_len, str); 
		max_len = len;
	}
}

int main (){
	init();
	while (~scanf("%s", str)){
		solve();
	}
	printf("%s %s\n", tmp_max_time, tmp_max_len);
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <map>
using namespace std;
int main(){
	string s,tmp,lw,histw;
	map<string,int> count;
	int maxh=0,maxl=0;
	getline(cin,s);
	stringstream ss;
	ss<<s;
	while(ss>>tmp){
		if(count.find(tmp)!=count.end())++count[tmp];
		else count[tmp]=1;
		if(count[tmp]>maxh){
			maxh=count[tmp];
			histw=tmp;
		}
		if(tmp.length()>lw.length())lw=tmp;
	}
	cout<<histw<<" "<<lw<<"\n";
	return 0;
}

C++: a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c)