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 <iostream>
#include <string>
#include <map>
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string str, longest="";
    map<string, int> words;
    while(cin>>str){
        if(longest.length()<str.length()) longest=str;
        if(words.find(str)==words.end()) words[str]=1;
        else ++words[str]; 
    }
    auto max = words.begin();
    for(auto it=words.begin(); it!=words.end(); ++it){
        if(max->second<it->second) max=it;
    }
    cout<<max->first<<' '<<longest<<'\n';
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	string ans = "";
	map <string ,int> mp;
	while(cin >> s){
		if(ans.size() < s.size())
			ans = s;
		mp[s]++;
	}
	int va = 0;
	string asdf;
	for(auto itr = mp.begin() ; itr != mp.end() ; itr++)
		if((*itr).second > va)
			asdf = (*itr).first;
	cout << asdf << " " << ans << endl;
}

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

char str[1100][34];
int  len[1100];
int n ;


string ans1 ="";

map<string,int> mp ;
void init_map(){
     mp.clear();
    for(int i=1;i<=n;i++){
        mp[str[i]] = 0 ;
    }
    for(int i=1;i<=n;i++){
       mp[str[i]]++;
    }
    int l =0;
    for( map<string,int>::iterator it = mp.begin();it!= mp.end();it++){
        if((it->second)>l){
	   ans1 = it->first;
	   l = it->second;
	}
    }            
}
int main(){
  int idx =1;
  while(~scanf("%s",str[idx])){
      len[idx] = strlen(str[idx]);
      idx ++;	
      
  }
   n = idx-1;
   init_map();
   cout << ans1<<" ";
    int l = 0;
    int maxidx  =0 ;
   for(int i=1;i<=n;i++){
      if(len[i]>l){
         maxidx = i;
	 l = len[i];
      }
   }
   cout << str[maxidx]<<endl;
 return 0;
}

C++: #include<iostream>
#include<vector>
#include<sstream>
#include<string>
using namespace std;
int main(){
  string str;
  getline(cin,str);
  stringstream ss(str);
  vector<string> v;
  vector<int> n;
  while(ss >> str){
    bool f=false;
    for(int i=0;i<v.size();i++){
      if(str==v[i]) {
	n[i]++;
	f=true;
      }
    }
    if(!f){
      v.push_back(str);
      n.push_back(1);
    }
  }
  str="";
  int c=0;
  for(int i=0;i<v.size();i++){
    if(c<n[i]) c=n[i];
  }
  for(int i=0;i<v.size();i++){
    if(n[i]==c) cout << v[i];
    if(str.size()<v[i].size()) str=v[i];
  }
  cout << " " << str << endl;
}

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

int main(){
	string s,alt="",lenm="",encm="";
	getline(cin,s);
	vector<string> vec;
	rep(i,s.size()){
		if(i==s.size()-1){
			alt+=s[i];
			vec.push_back(alt);
			alt="";
		}else if(s[i]==' '){
			vec.push_back(alt);
			alt="";
		}else alt+=s[i];
	}
	int cnt[vec.size()];
	rep(i,vec.size())cnt[i]=0;
	rep(i,vec.size()){
		if(vec[i].size()>lenm.size())lenm=vec[i];
		rep(j,vec.size()){
			if(vec[i]==vec[j])cnt[i]++;
		}
	}
	int ma=-1;
	rep(i,vec.size()){
		if(ma<cnt[i]){
			ma=cnt[i];
			encm=vec[i];
		}
	}
	cout<<encm<<" "<<lenm<<endl;
	return 0;
}

C++: #include<iostream>
#include<cstring>
#include<string>
#define MAX 1060
using namespace std;
typedef struct{
	char s[MAX];
	int sum;
} gg;
char mstr[MAX],lstr[MAX],str[MAX],pre[MAX];
int lon=0,r,gs=0,mx=0;
gg sp[MAX];
void func(int x){
	int i;
	for(i=0;i<gs;i++){
		if(strncmp(sp[i].s,&str[x],r)==0){
			sp[i].sum++;
			break;
		}
	}
	if(i==gs){
		strncpy(sp[gs].s,&str[x],r);
		sp[gs++].sum=1;
	}
	if(sp[i].sum>mx){
		mx=sp[i].sum;
		strcpy(mstr,sp[i].s);
	}
}
int lo(int x){
	int i,k=0;
	for(i=x;isalpha(str[i]);i++)
		pre[k++]=str[i];
		return i-x;
}
void solve(){
	for(int i=0;str[i]!='\0';i++){
		if(isalpha(str[i])){
			r=lo(i);
			if(r>lon){
				lon=r;
				strcpy(lstr,&str[i]);
			}
			func(i);
			i+=(r-1);
		}
	}
	
	
}
int main(){
	cin.getline(str,MAX);
		solve();
		cout<<mstr<<' '<<lstr<<endl;
	
	return 0;
}

C++: #include <utility>
#include <iostream>
#include <unordered_map>



int main()
{
    using map_type = std::unordered_map< std::string, int > ;
    map_type map ;

    std::string longest_word ;

    std::string word ;
    while ( std::cin >> word )
    {
        ++map[word] ;
        if ( longest_word.size() < word.size() )
        {
            longest_word = word ;
        }
    }

    std::pair< map_type::key_type, map_type::mapped_type> most_frequent_word ;
    for ( auto && elem : map )
    {
        if ( most_frequent_word.second < elem.second )
        {
            most_frequent_word = elem ;
            
        }
    }

    std::cout << most_frequent_word.first << ' ' << longest_word << '\n' ;
    
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int main() {
	multimap<int,string> words;
	string str;
	string maxstr="";
	for(;cin>>str;){
		if(maxstr.size()<str.size())maxstr=str;
		multimap<int,string>::iterator it;
		for(it=words.begin();it!=words.end();it++){
			if(it->second==str){words.insert(map<int,string>::value_type(it->first-1,str));}
			
		}
		words.insert(map<int,string>::value_type(-1,str));
		/*for(it=words.begin();it!=words.end();it++){
			cout<<it->second<<endl;
			cout<<1<<endl;
		}*/
		//cout<<str<<endl;
	}
	cout<<words.begin()->second<<" "<<maxstr<<endl;
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <map>
using namespace std;
int main(){
  string s,S;
  int mx = 0;
  map<string,int>mp;
  getline(cin,S);
  stringstream ss(S);
  string ans2,ans1;
  while(ss >> s){
    if((int)s.size() > mx){
      mx = s.size();
      ans1 = s;
    }
    mp[s]++; 
  }

  map<string,int>::iterator it = mp.begin();
  int mx2 = 0;

  for(;it != mp.end();it++){
    if((*it).second > mx2){
      mx2 = (*it).second;
      ans2 = (*it).first;
    }
  }
  cout << ans2 << ' ' << ans1 << endl;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
    long saidai=0;
    int a=0,cnt=0,num=0,max=0,t;
    string str,tango[1000]={""},answer,ans;
    getline(cin,str);
    for(int i=0;i<str.size();i++){
        if(str[i]==' '){
            for(int j=a;j<i;j++){
                tango[cnt]+=str[j];
            }
            cnt=cnt+1;
            a=i+1;
        }
    }
    for(int p=a;p<str.size();p++){
        tango[cnt]+=str[p];
    }
    
    
    
    for(int k=0;k<=cnt;k++){
        if(saidai<tango[k].size()){
            saidai=tango[k].size();
            ans=tango[k];
        }
    }
    
    for(int s=0;s<cnt;s++){
        num=1;
        for(t=s+1;t<=cnt;t++){
            if(tango[s]==tango[t]){
                num=num+1;
            }
        }
        if(max<num){
            max=num;
            answer=tango[s];
        }
    }
    
    for(int x=0;x<=cnt;x++){
        cout<<" "<<tango[x];
    }cout<<endl;
    cout<<max<<" "<<saidai<<endl;
    cout<<answer<<" "<<ans<<endl;
    return 0;
}