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<algorithm>
using namespace std;

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

C++: #include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
      string s,nmax,gmax;
      map<string,int> m;
      map<string,int>::iterator it;
      int nm=-1,gm=-1;
      while(cin>>s){
            if(nm<s.length()){
                  nm=s.length();
                  nmax=s;
            }
            if(m.count(s))m[s]++;
            else m[s]=0;
      }
      for(it = m.begin();it!=m.end();it++){
            if(gm<it->second){
                  gm = it->second;
                  gmax = it->first;
            }
      }
      cout <<gmax<<' '<<nmax<<endl;
}

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

using namespace std;

int main(){
  int max = 0, longest=0,i;
  map<string,int> word, cnt;
  string s, max_s, longest_s;
  while(cin>>s){
    word[s]++;
    if(word[s]>max){
      max = word[s];
      max_s = s;
    }
    i=0;
    while(s[i] != '\0' && s[i] != '\n'){
      i++;
    }
    cnt[s] = i;
    if(cnt[s]>longest){
      longest=cnt[s];
      longest_s=s;
    }
  }  
  cout<<max_s<<' '<<longest_s<<endl;
  return 0;
}

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

int main(void){
	string str;
	int mt=0,ml=0;
	string ms,mst;
	map<string,int> m;

	while(cin>>str){
		if(str.length()>ml){
			ml=str.length();
			ms=str;
		}
		m[str]++;
	}
	for(map<string,int>::iterator it=m.begin();it!=m.end();it++){
		if(it->second>mt){
			mt=it->second;
			mst=it->first;
		}
	}
	cout<<mst<<" "<<ms<<endl;

}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string.h>
#include <queue>
#include <string>
#include <stack>
#include <utility>
#include <queue>
#include <cmath>
#define mp make_pair
#define pii pair<int,int> 
#define ff first
#define ss second
#define ll long long 
#define vi vector<int>

using namespace std;

int counts[1000];
char str[1000][100];
int maxl,i,indexml,indexma;

int main()
{
	maxl=0;
	indexml=0;
	indexma=0;
	i=0;
	memset(counts, 0, sizeof(counts));
	while(scanf("%s",str[i])!=EOF)
	{
		//if(str[i][0]=='z')break;
		if(maxl<strlen(str[i]))
		{
			maxl=strlen(str[i]);
			indexml=i;
		}
		for(int z=0;z<i;z++)
		{
			if(strcmp(str[i],str[z])==0)
			{
				counts[z]++;
				i--;
				break;
			}
		}
		i++;
	}
	for(int c=0;c<i;c++)
	{
		if(counts[indexma]<counts[c])
		indexma=c;
	}
	printf("%s %s\n",str[indexma],str[indexml]);
	return 0;
}

C++: #include <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF (((ll)1<<31)-1)
#define eps LDBL_EPSILON
#define moder (1000000007)
#define pie acos(-1)
#define P std::pair<int,int>
#define prique priority_queue
#define ggr getchar();getchar();return 0;
using namespace std;
string s;
map<string,int> mp;
signed main(){
	int maw=0;
	string mw;
	while(cin>>s){
		mp[s]++;
		if(s.size()>maw){
			mw=s;
			maw=s.size();
		}
	}
	int ofw=0;
	string ow;
	for(pair<string,int> p:mp){
		if(p.second>ofw){
			ofw=p.second;
			ow=p.first;
		}
	}
	cout<<ow<<" "<<mw<<endl;
	return 0;
}

C++: #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

#include <array>

using namespace std;

int main ()
{
	string str,ans1="",ans2="";
	map<string , int>d;
	while( cin >> str )
	{
		d[str]++;
	}

	int p = 0;
	for( auto x : d )
	{
		if( p < x.second )
		{
			p = x.second;
			ans1 = x.first;
		}
		if( ans2.length () < x.first.length() )
		{
			ans2 = x.first;
		}
	}
	cout << ans1 << " " << ans2 << endl;
}

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

struct Inf
{
      char save[35];
}inf[1100];

bool cmp(struct Inf a,struct Inf b)
{
      return strcmp(a.save,b.save)<0;
}
int main()
{
      int num=0,maxn=0,flag2;
      char ans2[38],last[39];

      while(cin>>inf[num].save)
      {
           
            int len=strlen(inf[num].save);

            if(len>maxn)
            {
                  maxn=len;
                  flag2=num;
            }
            num++;
      }
      strcpy(ans2,inf[flag2].save);
      sort(inf,inf+num,cmp);

      int sum=1;
      flag2=0;
      int Max=1;
      strcpy(last,inf[0].save);
     
      for(int i=1;i<num;i++)
      {
            if(strcmp(inf[i].save,last)==0)
                  sum++;
            else
            {
                  if(sum>Max)
                  {
                        Max=sum;
                        flag2=i-1;
                  }
                  sum=1;

            }
            strcpy(last,inf[i].save);
      }

      if(sum>Max)
         flag2=num-1;



     cout<<inf[flag2].save<<" "<<ans2;


      return 0;
}