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<string>
#include<map>
#include<cctype>
using namespace std;
int main(){
	map<string, int> mpa;
	string most_frequent_word, longest_word;
	string s;
	int max_frequency = 0, max_length = 0;
	while(cin >> s){
		if(s.length() > max_length){
			max_length = s.length();
			longest_word = s;
		}
		for(int i = 0; i < s.length(); i++) s[i] = tolower(s[i]);
		mpa[s]++;
	}
	map<string, int>::iterator itr;
	for(itr = mpa.begin(); itr != mpa.end(); itr++){
		if(itr -> second > max_frequency){
			max_frequency = itr -> second;
			most_frequent_word = itr -> first;
		}
	}
	cout << most_frequent_word << ' ' << longest_word << endl;
	return 0;
}

C++: #include<iostream>
#include<map>
using namespace std;
map<string,int>mp;
string ans,s,amins;
int maxn=0,minn=0;
int main()
{
    while(cin>>s)
    {
        mp[s]++;
        if(mp[s]>maxn)
        {
                      maxn=mp[s];
                      ans=s;
        }
        if(s.size()>minn)
        {
                         minn=s.size();
                         amins=s;
        }
    }
    cout<<ans<<" "<<amins<<endl;
    return 0;
}

C++: #include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
	string str,s,mls,mcs,input[32];
	map <string,int> dic;
	int n,c,a,ml,mc;
	while(getline(cin,str)){
		c = a = mc = ml = 0;
		str += ' ';
		while(str.length()){
			n = str.find(' ');
			s = str[c];
			++c;
			for(;c < n;++c){
				s += str[c];
			}
			str.erase(0,n+1);
			c = 0;
			input[a] = s;
			++a;
			++dic[s];
			if(s.length() > ml) {
				ml = s.length();
				mls = s;
			}
		}
		for(int i = 0;i < a;++i){
			if(mc < dic[input[i]]){
				mc = dic[input[i]];
				mcs = input[i];
			}
		}
		cout << mcs << " " << mls << endl;
	}
	return 0;
}

C++: #include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    string ans0,ans1;
    string str;
    string lis[1000];
    int lissize=0;
    getline(cin,str);
    str.push_back(' ');
    for(int i=0;i<str.size();i++){
        for(int j=i;j<str.size();j++){
            if(str[j]==' '){
                lis[lissize]=str.substr(i,j-i);
                lissize++;
                i=j+1;
            }
        }
    }
    sort(lis,lis+lissize);
    int ans=0,karians=1;
    for(int i=1;i<lissize;i++){
        if(lis[i]==lis[i-1])karians++;
        else karians=1;
        if(ans<karians){
            ans=karians;
            ans0=lis[i];
        }
    }
    if(ans<karians)ans0=lis[lissize-1];
    karians=0;
    for(int i=0;i<lissize;i++){
        if(karians<lis[i].size()){
            karians=lis[i].size();
            ans1=lis[i];
        }
    }
    cout<<ans0<<' '<<ans1<<endl;
    return 0;
}

C++: #include <iostream>
#include <string>
#include <map>
using namespace std;
int M,l;main(){string s,t,u;map<string,int>m;for(;cin>>u;t=t.size()<u.size()?u:t)if(++m[u]>M)M=m[u],s=u;cout<<s<<' '<<t<<endl;}

C++: #include <iostream>
#include <cstring>
#include <cstdio> //fgets
using namespace std;

int main(){
	char str[1001];
	char word[100][100]={0};
	int longest=0;
	int check[100]={0};
	char *tmp;
	int freq=0;
	int count=0;
	int i,j;
	size_t len , prev;
	fgets(str , sizeof(str) , stdin);
		tmp=str;
		for(i=0 ; str[i]!='\0' ;i++){
			if(str[i]==' '){
				str[i]='\0';
				strcpy((char*)&word[count] , (const char*)tmp);
				tmp=str+i+1;
				count++;
			}
		}
		strcpy((char*)&word[count],(const char*)tmp);
		count++;
	for(i=0 ; i<count ; i++){
		for(j=i ; j<count ; j++){
			if(strcmp((const char*)&word[i] , (const char*)&word[j])==0){
				check[i]++;
			}
		}
	}
	for(i=0 ; i<count-1 ; i++){
		if(check[freq]<check[i+1]){
			freq=i+1;
		}
	}
		prev=strlen(word[0]);
	for (i=1 ; i<count ; i++){
		len=strlen(word[i]);
		if(len > prev){
			prev = len;
			longest=i;
		}
	}
	cout << (char*)&(word[freq]) << " "<< (char*)&(word[longest]) << endl;
	return 0;
}

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

int main(){
	map<string, int> word;
	vector<string> w;
	string str;
	int max=0,length=0;

	while(cin >> str){
			
		w.push_back(str);
		
		//??\???????????????????????§??????????????¢???
		if(word.find(str) != word.end() ){
			word[str]++;
		}else{
			word.insert( pair<string, int>(str,1));
		}
	}
	
	map<string,int>::iterator p;
	for(p = word.begin() ; p != word.end() ; p++){
		if( max < p->second) max = p->second;
	}
	for(p = word.begin() ; p != word.end() ; p++){
		if( max == p->second){
			cout << p->first << " ";
			break;
		}
	}
	for(int i=0 ; i<w.size() ; i++){
		if( length < w[i].size() ) length = w[i].size();
	}
	for(int i=0 ; i<w.size() ; i++){
		if( length==w[i].size() ){
			cout << w[i] << endl;
			break;
		}
	}
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int const N = 1000;
int main(){
  char str[N][33];
  int num[N],i=0,max=0,l=0;
  while(cin >> str[i]){
    i++;
  }
  for(int j =0;j<i;j++){
    num[j] =j;
  }
  for(int j=0;j<i;j++){
    for(int k=0;k<i;k++){
      if(strcmp(str[j],str[k]) == 0)
	num[j]++;
    }
    if(num[max] < num[j])
      max = j;
    if(l < strlen(str[j]))
      l = j;
  }

  cout <<  str[max] <<" "<< str[l] << endl;
}

C++: #include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;
 
int main(){
    int m[1000],n=0,M=0,N=0,w,I,J,j;
    string r[1000],s;
    while(cin>>s){
        w=0;
        if(s.size()>M){M=s.size();I=n;}
        for(int i=0;i<n;i++)if(s==r[i]){m[i]++;w=1;j=i;break;}
        if(w==0){r[n]=s;m[n]=1;j=n;n++;}
        if(m[j]>N){N=m[j];J=j;}
    }
    cout<<r[J]<<" "<<r[I]<<endl;
}

C++: #include<iostream>
#include<vector>
using namespace std;
#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = a ; i < b ; i ++)

int main(void){
  string s,len="";
  getline(cin,s);
  
  s += ' ';
  vector<string> arys;
  string ss="";
  rep(i,s.size()){
    if(s[i] != ' '){
      ss += s[i];
    }else{
      arys.push_back(ss);
      if(len.size() < ss.size())len=ss;
      ss = "";
    }
  }
  vector<int> aryi(arys.size(),0);
  int n = arys.size(),used=0,index=-1;
  rep(i,n){
    loop(j,i,n){
      if(arys[i] == arys[j]){
        aryi[i]++;
        if(aryi[i] > used){
          index = i;
          used = aryi[i];
        }
      }
    }
  }
  
  cout<<arys[index]<<" "<<len<<endl;

}

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

int main(){
  string s;
  map<string, int> mp;
  while (cin >> s) {
    mp[s]++;
  }
  string maxv = mp.rbegin()->first;

  int maxstr = 0;
  string ansstr;
  for (auto x : mp) {
    if (x.first.size() >= maxstr) {
      maxstr = x.first.size();
      ansstr = x.first;
    }

  }
  cout << maxv << " " << ansstr << endl;

}

C++: #include<iostream>
#include<map>
#include<string>
using namespace std;
int main()
{
    map<string,size_t> word_count;
    string word;
    while(cin>>word)
        ++word_count[word];
    map<string,size_t>::iterator a,b,c;
    a=b=word_count.begin();
    for( c=word_count.begin();c!=word_count.end();c++)
    {
        if(c->first.size()>a->first.size())
            a=c;
        if(c->second>b->second)
            b=c;
    }
    cout<<b->first<<' '<<a->first<<"\n";
    return 0;
}