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 <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;
    vector<string> v;
    while(cin>>s){
        v.pb(s);
    }
    cout << v.size() << endl;
    for(i=0;i<v.size();i++){
        cnt=0;
        for(j=0;j<v.size();j++){
            if(v[i]==v[j]){
                cnt++;
            }
        }
        if(nmax<cnt){
            nmax=max(cnt,nmax);
            nind=i;
        }
        if(lmax<v[i].size()){
            lmax=max(lmax,v.size());
            lind=i;
        }
    }
    cout << v[lind] << v[nind] << endl;
}

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

using namespace std;

int main()
{
	char s[1000];
	int n=0;
	cin.getline(s,1000);
	string tok[1000];
	char *sep=" ,.";
	char *word;
	word = strtok(s,sep);
	while(word != NULL)
	{
		tok[n] = word;
		n++;
		word=strtok(NULL,sep);
	}
	int f=1,fmax=1;
	string max, freq;
	max=tok[0]; freq=tok[0];
	for(int i=0;i<n;i++)
	{
		if(tok[i].length()>max.length())
			max=tok[i];
		f=1;
		for(int j=i+1;j<n;j++){
			if(tok[i]==tok[j])
				f++;
		}
		if(f>fmax)
		{
			fmax=f; freq=tok[i];
		}
	}
	cout << freq <<" " <<max<<endl;
}

C++: #include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
  string s,a,b="";
  int c=0;
  map<string,int> m;
  while(cin>>s){
    if(s.length()>b.length())b=s;
    m[s]++;
  }
  map<string,int>::iterator it = m.begin();
  while(it!=m.end()){
    if((*it).second>c)c=(*it).second,a=(*it).first;
    it++;
  }
  cout<<a<<" "<<b<<endl;
  return 0;
}

C++: #include <bits/stdc++.h>
#define read() freopen("input", "r", stdin)
using namespace std;

int main(void)
{
	string s;
	map<string, int> m;

	string mx, f;
	while(cin >> s){
		m[s] += 1;

		if(s.length() > mx.length())
			mx = s;
	}

	map<string, int>::iterator it;
	int mn = 0;
	for(it = m.begin(); it != m.end(); it++)
		if(mn < it->second)
			f = it->first;

	cout << f << " " << mx << endl;

	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].s[r]='\0';
		sp[gs++].sum=1;
	}
	if(sp[i].sum>mx){
		mx=sp[i].sum;
		strcpy(mstr,sp[i].s);
		mstr[strlen(sp[i].s)]='\0';
	}
}
int lo(int x){
	int i;
	for(i=x;isalpha(str[i]);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;
				strncpy(lstr,&str[i],r);
				lstr[r]='\0';
			}
			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<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 << endl;
	return 0;
}

C++: #include <string>
#include <map>
#include <iostream>
using namespace std;
int main() 
{
	map<string,int> table;
	string word,frequent,longest;
	size_t N=0;
	while(cin>>word)
	{
		table[word]++;
		if(table[word]>N)
		{
			N=table[word];
			frequent=word;
		}
		if(word.size()>longest.size())
			longest=word;
	}
	cout<<frequent<<" "<<longest<<endl;
}

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

map<string,int> table;

int main() {

	string word, frequent, longest;
	size_t N=0;

	while ( cin >> word ) {

		table[word] += 1;

		if ( table[word] > N ) {

			N = table[word];
			frequent = word;

		}

		if ( word.size() > longest.size() ) {

			longest = word;

		}

	}

	cout << frequent << " " << longest << endl;

}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pii;

int main(){
	map<string,int> table;
	string s,f,l;
	size_t n=0;
	while(cin>>s){
		//if(s=="0") break;
		table[s]++;
		if(table[s]>n){
			n=table[s]; f=s;
		}if(s.size()>l.size()) l=s;
	}
	o(f<<" "<<l);
}

C++: #include<iostream>
#include<string>
#include<map>
#include<cstring>
#include<cstdio>
using namespace std;
int main()
{
  map<string,int> str;
  string word;
  int big = 0;
  int cnt = 0;
  string keepword;
  string keepstr = "";
  string many = "";
  
  while(!cin.eof()){
    cin >> word;
    string kari(word);
    str[kari]++;
    
    if(cnt < str[kari]){
      cnt = str[kari];
      keepstr = kari;
    }
    
    if(big < word.size()){
      big = word.size();
      keepword = word;
    }
  }
  cout << keepstr << " " << keepword << endl;
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)


string t;
vector < string> st;
int s[1000]={0};
int max1=0;
int max2=0;

int main(){
	while(cin >>t){
		bool flag=true;
		int tmp = t.size();
		max1 = max(max1,tmp );
		rep(i,st.size()){
			if(t == st[i]){
				s[i]++;
				max2 = max(max2,s[i]);
				flag = false;
				break;
			}
		}
		if(flag){
			st.push_back(t);
		}
	}
	rep(i,st.size()){
		if(s[i]==max2){
			cout<<st[i]<<" ";
			break;
		}
	}
	rep(i,st.size()){
		if(st[i].size()==max1){
			cout<<st[i]<<endl;
			break;
		}
	}
	return 0;
}

C++: #include <unordered_map>
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
  unordered_map<string,int> us;
  string s;
  while(cin >> s){
    us[s]++;
  }
  string ans1;
  int times = 0;
  string ans2;
  int length = 0;
  for(auto i : us){
    if(i.second > times){
      ans1 = i.first;
      times = i.second;
    }
    if(i.first.length() > length){
      ans2 = i.first;
      length = i.first.length();
    }
  }
  cout << ans1 << ' ' << ans2 << '\n';
     
}