Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	l := sc.Text()
	words := strings.Split(l, " ")

	frequency := map[string]int{}
	long := map[string]int{}
	var maxFrequency, longest int
	var frequentWord, longestWord string
	for _, w := range words {
		frequency[w]++
		long[w] = len(w)
		if frequency[w] > maxFrequency {
			maxFrequency = frequency[w]
			frequentWord = w
		}
		if len(w) > longest {
			longest = long[w]
			longestWord = w
		}
	}

	fmt.Println(frequentWord + " " + longestWord)
}

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;
}

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);
}