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 <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

int main() {
map<string,int> msi;
string s;
int ma=0;
int ma2=0;
string ans;
string ans2;
while (cin >> s,){
	if (!EXIST(msi,s))
		msi[s]=1;
	else{
		msi[s] = msi[s]+1;
		if (ma2<msi[s]){
		ans2=s;
		ma2 = msi[s];
		}
		}
	if (ma < s.length()){
	ans=s;
	ma = s.length();
	}
}
cout << ans2 << " "<<ans<<endl;
	return 0;
}

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

int main() {
	string str[1000],tmp;
	int a[1000] = {}, flag = 0, max = 1, i, length = 0, num = 0;

	while (cin >> tmp) {
		if (flag == 0) {
			flag++;
			tmp[0] = tmp[0] - 'a';
		}
		for (i = 0; i < max; i++) {
			if (tmp == str[i]){
				a[i]++;
				break;
			}
		}
		if (i == max)
			str[i] = tmp;
	}
	if (size(tmp) > length) {
		num = i;
		length = size(tmp);
	}

	cout << str[max] << " " << str[length] << endl;
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<map>
using namespace std;
char a[1005];
int main()
{

    string b,c;
    int i,j;
    while(gets(a))
    {
        map<string,int>M;
        int len = strlen(a);
        string s;
        a[len]=' ';
        s="";
        int m = -1,g=0,gg=-1;
        j=0;
        for(i=0;i<len+1;i++)
        {
            //cout<<a[i]<<"&&"<<j<<endl;
            if(a[i]==' ')
            {
                if(M[s]==0&&s!="")
                  M[s]++;
                else M[s]++;
                //cout<<s<<"^^"<<M[s]<<endl;
                if(g>gg)
                {
                    gg=g;
                    c=s;
                    //cout<<g<<" "<<s<<endl;
                }
                if(M[s]>m)
                {
                    m=M[s];
                    b=s;
                    //cout<<m<<" ** "<<b<<endl;
                }
                s="";
                g=0;
            }
            else if((a[i]>='a'&&a[i]<='z')||(a[i]>='A'&&a[i]<='Z'))
            {
                s+=a[i];
                g++;
            }

        }

        cout<<b<<" "<<c<<endl;
    }
}

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

int main(){
    string in;
    string p,q;
    int ma=0;
    map<string,int>mp;

    while(cin>>in){
        if(in.size()>q.size())q=in;
        mp[in]++;
        if(ma<mp[in]){
            ma=mp[in];
            p=in;
        }
    }
    cout<<p<<" "<<q<<endl;
}

C++: #include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef pair<string, int> PAIR;

int main(){
	vector<PAIR> vec;
	vector<PAIR>::iterator ite;
	string st;
	while(cin >> st){
		ite = vec.begin();
		if(vec.empty()){
			vec.push_back(PAIR(st, 1));
		}else{
			while(1){
				if((*ite).first == st){
					(*ite).second++;
					break;
				}
				ite++;
				if(ite == vec.end()){
					vec.push_back(PAIR(st, 1));
					break;
				}
			}
		}

		vector<PAIR>::iterator max = vec.begin();
		vector<PAIR>::iterator mim = vec.begin();
		for(ite = vec.begin(); ite != vec.end(); ite++){
			if((*max).second < (*ite).second) max = ite;
			if((*mim).second > (*ite).second) mim = ite;
		}

		cout << (*max).first << " " << (*mim).first << endl;

	}
	return 0;
}

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

int main(void){
  map<string,int>m;
  map<string,int>::iterator it,cit,sit;
  string s;
  int maxS=0,maxC=0;
  while(cin >>s){
    m[s]+=1;
  }
  for(it=m.begin();it!=m.end();it++){
    int size=(*it).first.size();
    if(size>maxS)sit=it;maxS=size;
    int cou=(*it).second;
    if(cou>maxC)cit=it;maxC=cou;
  }
  cout <<(*cit).first <<" "<<(*sit).first<<endl;
}

C++: #include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

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


#define X real()
#define Y imag()
typedef complex<double> P;

int main(){
	
	typedef pair<int,string> pis;
	vector<pis> a;
	vector<pis> b;
	
	map<string,int> m;
	
	string str;
	while(cin>>str){
		a.push_back( pis((int)str.size(),str) );
		m[str]++;
	}
	
	map<string,int>::iterator it=m.begin();
	while(it!=m.end()){
		b.push_back(pis(-it->second,it->first));
		it++;
	}
	
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	
	cout<<b[0].second<<" "<<a[a.size()-1].second<<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<iostream>
#include<string>
using namespace std;

int main() {
	string str[1000],tmp;
	int a[1000] = {}, flag = 0, max = 1, i, length = 0, num = 0;

	while (cin >> tmp) {
		if (flag == 0) {
			flag++;
			tmp[0] = tmp[0] - 'a';
		}
		for (i = 0; i < max; i++) {
			if (tmp == str[i]){
				a[i]++;
				break;
			}
		}
		if (i == max)
			str[i] = tmp;
	}

	if ((int)tmp.size() > length) {
		num = i;
		length = (int)tmp.size();
	}

	cout << str[max] << " " << str[length] << endl;
	return 0;
}

C++: #include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

int main(){
    string s;
    getline(cin,s);
    vector<string> str;
    s+=" ";
    string buf="";
    rep(i,s.size()){
        if(s[i]!=' '){
            buf+=s[i];
        }
        else{
            str.pb(buf);
            buf="";
        }
    }
    map<string,int> mp;
    rep(i,str.size()){
        mp[str[i]]++;
    }
    string ans="";
    int n=-1;
    rep(i,str.size()){
        if(mp[str[i]]>n){
            ans = str[i];
            n=mp[str[i]];
        }
    }
    string l="";
    int num=-1;
    rep(i,str.size()){
        if((int)(str[i].size())>num){
            num=str[i].size();
            l=str[i];
        }
    }
    cout<<ans<<" "<<l<<endl;
}