Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

type Pair struct {
	key   string
	value int
}

func main() {
	scanner.Split(bufio.ScanWords)
	counts := map[string]int{}
	maxLen := 0
	maxLenWord := ""
	for {
		word := nextString()
		if word == "" {
			break
		}

		counts[word]++

		if len(word) > maxLen {
			maxLen = len(word)
			maxLenWord = word
		}
	}

	mapPairs := []Pair{}
	for k, v := range counts {
		mapPairs = append(mapPairs, Pair{k, v})
	}
	sort.Slice(mapPairs, func(i, j int) bool { return mapPairs[i].value > mapPairs[j].value })

	fmt.Println(mapPairs[0].key, maxLenWord)
}

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;
// English Sentence (0029)
int main()
{
	map<string,int>a;
	string ret1,ret2;
	int maxnum=0,maxlen=0;
	string s;
	while (1){
		if(!(cin>>s)) break;;
		int num=++a[s];
		if(maxnum<num){ 
			maxnum=num;
			ret1=s;
		}
		if(maxlen < s.size()){
			maxlen=s.size();
			ret2=s;
		}
	}
	cout<<ret1<<" "<<ret2<<endl;
	return 0;
}

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

void countword(string s){
    map<string, int>m;
    stringstream ss(s);
    string word, maximum, maximum_l;
    int Max1 = 0, Max2 = 0;
    while(ss >> word){
        if(word.size() > Max1){
            Max1 = word.size();
            maximum_l = word;
        }
        m[word]++;
    }
    map<string, int>::iterator it;


        for(it = m.begin(); it != m.end(); it++){
        if(Max2 < it->second){
            Max2 = it->second;
            maximum = it->first;
        }
    }
    cout<<maximum<<" "<<maximum_l<<endl;
}


int main()
{
    string s;
    getline(cin, s);
    countword(s);
}

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

int main() {
    string word, largestWord, mostFrequentWord;
    int maxLength = 0, mode = 0;    
    map<string, int> words;

    while (cin >> word) {
        if (words.count(word)) {
            words[word]++;
            if (words[word] > mode) { 
                mode = words[word];
            }
        }
        else {
            words[word] = 1;            
        }

        if (word.size() > maxLength) {
            maxLength = word.size();
            largestWord = word;
        }
    }
    
    for (map<string, int>::iterator it = words.begin(); it != words.end(); ++it) {
        if (it->second == mode) {
            mostFrequentWord = it->first;
        }
    }

    cout << mostFrequentWord << " " << largestWord << endl;
    return 0;
}

C++: #define _USE_MATH_DEFINES
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

int main(){
	vector<string> str;
	int count[1000]={0};
	//int length[1000]={0};
	string max_length="";

	string s;
	while(cin >> s){
		int i;
		bool find_flag = 1;
		for(i=0;i<str.size();i++){
			if(str[i]==s){
				count[i]++;
				find_flag = 0;
				break;
			}
		}
		if( find_flag ){
			str.push_back(s);
			if(s.size()>max_length.size()){
				max_length = s;
			}
		}
	}
	
	int max = 0;
	for(int i=0;i<str.size();i++){
		if(count[i]>max){
			max=i;
		}
	}
	cout << str[max] << " " << max_length << endl;
	
	return 0;
}

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

using namespace std;

int main(){
	string in[10000];
	int max=0;
	string ml_str;
	int tmp;
	string ans;
	int i=0;
	for(i=0;cin>>in[i];i++){
		if(in[i].size()>max){
			max=in[i].size();
			ml_str=in[i];
		}
	}
	in[i+1]="end";
	sort(in,in+i);
	tmp=1;
	max=0;
	//cout<<in[0]<<" ";
	for(int j=1;j<=i;j++){
	//cout<<in[j]<<" ";
		if(in[j]==in[j-1]){
			tmp++;
			//cout<<endl<<in[j]<<tmp<<endl;
		}else{
			if(max<tmp){
				max=tmp;
				
				ans=in[j-1];
				tmp=1;
			}
		}
	}
	cout<<ans<<" "<<ml_str<<endl;
}

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

using namespace std;

int main()
{
	string str[10000],mstr,lstr;
	int size=0,max=0,i,j;
	
	for(i=0;cin >> str[i];i++)
	{
		if(size<str[i].size())
		{
			size=str[i].size();
			lstr=str[i];
		}
	}
	for(j=0;j<i;j++)
	{
		int count=0;
		for(int k=0;k<i;k++)
			if(str[j]==str[k])
				count++;
		if(max<count)
		{
			max=count;
			mstr=str[j];
		}
	}
	cout << mstr << " " << lstr << endl;
}

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

using namespace std;

int main() {
    map<string, int> dict;

    string mode, longest;
    while (true) {
        char buf[48];
        if (scanf("%s", buf) == EOF)
            break;

        string word(buf);
        ++dict[word];

        if (dict[mode] < dict[word])
            mode = word;

        if (longest.length() < word.length())
            longest = word;
    }

    
    printf("%s %s\n", mode.c_str(), longest.c_str());
    return 0;
}

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

using namespace std;

void Solution()
{
    string str;
    
    string most_Freq;
    string most_Long;
    
    int times = 0;
    
    map<string, int> data; // in this case, the default value of integer is "0", value can be recognized by "string" name
    
    most_Long = most_Freq = str;
    
    while (cin>>str)
    {
        data[str]++; //start to accumulate the data by variety "str"
        
        if (str.size() > most_Long.size()) //verify the longest word based on size
        {
            most_Long = str;
        }
        
        if (data[str] > times)
        {
            most_Freq = str;
            times = data[str];
        }
    }
    
    cout << most_Freq << " " << most_Long << endl;

}

int main()
{
    Solution();
    return 0;
}

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

int main(){
	string s, str1, str2;
	int maxn = 0;
	map<string, int> mp;
	while(cin >> s){
		mp[s]++;
		if(mp[s] > maxn){maxn = mp[s];str1 = s;}
		int si1 = s.size();int si2 = str2.size();
		if(si1 > si2){str2 = s;}
	}
	cout << str1 << " " << str2 << 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,vv;
    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()){
            vv=v[i];
            lmax=max(lmax,vv.size());
            lind=i;
        }
    }
    cout << v[lind] << v[nind] << endl;
}