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

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <list>
using namespace std;
#define F first
#define S second
typedef pair<string ,int> P;

int main(void){
	string tmp;
	int now=0;
	P list[1000];
	P cmax,lmax;
	cmax.S=0,lmax.S=0;
	for(int i=0;i<1000;i++)
		list[i].S=0;
	while(true){
		if(cin.eof())
			break;
		cin >> tmp;
		bool check=false;
		for(int i=0;i<now;i++){
			if(tmp==list[i].F){
				list[i].S++;
				check=true;
				break;
			}
		}
		if(check)
			continue;
		else
			list[now].F=tmp,list[now].S++,now++;
	}
	for(int i=0;i<now;i++){
		if(list[i].S>cmax.S)
				cmax.S=list[i].S,cmax.F=list[i].F;
		if(list[i].F.size()>lmax.S)
				lmax.S=list[i].F.size(),lmax.F=list[i].F;
	}
	cout << cmax.F <<  ' ' << lmax.F << endl;
	return 0;
}