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<iostream>
#include<string>
#include<map>
using namespace std;
map<string, int> table;
int main()
{
    string word, frequent="", longest="";
    int  N = 0;
    while (cin >> word)
    {
        if (table.find(word) == table.end())
            table[word] = 0;
        table[word]++;
        if (N < table[word])
        {
            N = table[word];
            frequent = word;
        }
        if (word.size()>longest.size())
            longest = word;
    }
    cout << frequent << " " << longest << endl;
    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
int main(){
    char a[1100] = {0};
    scanf("%[^\n]",a);
    int cnt = 0;
    int mx = 0;
    int len[50] = {0};
    string ans[50];
    for(int i = 0,j = 0; i <= strlen(a); i++){
        if('a' <= a[i] && a[i] <= 'z' || 'A' <= a[i] && a[i] <= 'Z'){
            ans[cnt] += a[i];
            j++;
        }
        else{
            len[cnt] = j;
            cnt++;
            mx = max(mx,j);
            j = 0;
        }
    }
    string date;
    for(int i = 0; i < cnt; i++){
        if(len[i] == mx){
            date = ans[i];
            break;
        }
    }
    sort(ans,ans+cnt);
    fill(len,len+50,0);
    string mx_date = ans[0];
    ans[cnt] = ' ';
    mx = 0;
    for(int i = 1; i <= cnt; i++){
        if(mx_date == ans[i]){
            mx++;
        }
        else{
            mx_date = ans[i];
            len[i-1] = mx;
            mx = 0;
        }
    }
    for(int i = 0; i < cnt; i++){
        mx = max(mx,len[i]);
    }
    for(int i = 0; i < cnt; i++){
        if(len[i] == mx){
            cout << ans[i] << ' ' << date << endl;
            break;
        }
    }

    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	map<string,int>in;
	string s;
	int ma=0;
	string mas="";
	while(cin>>s){
		if(s.size()>ma){ma=s.size();mas=s;}
		in[s]++;
	}
	int ma1=-1;string mas1="";
	for(map<string,int>::iterator it=in.begin();it!=in.end();it++){
		string d=it->first;
		if(ma1<in[d]){
			ma1=in[d];
			mas1=d;
		}
	}
	cout<<mas1<<" "<<mas<<endl;
}

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<map>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	string b,mx; map<string,int> d;
	while(cin>>b){
		d[b]++; if(b.size()>mx.size())mx=b;
	}
	cout<<max_element(d.begin(),d.end())->first<<" "<<mx<<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,vv;
    vector<string> v;
    while(1){
        cin>>s;
        if(cin.eof()) break;
        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[nind] << v[lind] << endl;
}

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


int main()
{
	string s;
	map <string, int> m;
	map <string, int> m2;
	int maxlen = -1;

	pair<string, int> max_pair;
	pair<string, int> max2_pair;
	while (cin >> s){
		if (m.count(s) == 0){
			m.insert(pair<string, int>(s, 0));
			m2.insert(pair<string, int>(s, (int)s.length()));
		}
		else{
			m[s]++;
		}
	}

	for (auto pm = m.begin(); pm != m.end(); pm++){
		if (pm->second > max_pair.second){
			max_pair = *pm;
		}
	}
	for (auto pm = m2.begin(); pm != m2.end(); pm++){
		if (pm->second > max2_pair.second){
			max2_pair = *pm;
		}
	}
	cout << max_pair.first << " "<<max2_pair.first<<endl;
	return 0;
}

C++: #import<iostream>
#import<string>
#import<map>
using namespace std;int main(){map<string,int>m;string s,t,u;for(;cin>>s;s.length()>u.length()?u=s:u)++m[s]>m[t]?t=s:s;cout<<t<<" "<<u<<"\n";}

C++: #include "bits/stdc++.h"
using namespace std;
pair<int,string> namesize[1000];
map<string, int> table;
string word;
int i = 0;

int main() {
    while (cin >> word) {
        namesize[i].second = word;
        namesize[i].first = word.size();
        i++;
        table[word] += 1;
    }
    int max=0;
    string maxword;
    for (map<string,int>::iterator p = table.begin(); p != table.end(); ++p) {
        if (max < p->second) {
            max = p->second;
            maxword = p->first;
        }
    }
    sort(namesize, namesize + i);
    reverse(namesize, namesize + i);
    cout << maxword << " " << namesize[0].second<<endl;



}

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

using namespace std;

map<string, int> cnt;
string max_str;
int num_max;
int main() {
    string str;
    while (cin >> str) {
        cnt[str]++;
        num_max = max(num_max, cnt[str]);
        if (max_str.size() < str.size()) {
            max_str = str;
        }
    }

    for (auto e : cnt) {
        if (e.second == num_max) {
            cout << e.first << " ";
        }
    }
    cout << max_str << endl;
}