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

int main() {
	//??£?¨?
	int most_views = 0,views=0,most_long=0,len=0;
	char tmp_sentence[1000];
	string sentence,mo_ma_word,longest_word,word="";
	vector<string> words;

	cin.getline(tmp_sentence, sizeof(tmp_sentence));
	sentence = tmp_sentence;
	for (int i = 0; i < sentence.size(); i++) {
		if (sentence[i] == ' ') { words.push_back(word); word = ""; }
		else word = word + sentence[i];
	}
	words.push_back(word);
	for (int i = 0; i < words.size(); i++) {
		for (int j = 0; j < words.size(); j++) {
			if (words[i] == words[j])views++;
		}
		if (most_views < views) {
			most_views = views;
			mo_ma_word = words[i];
		}
		views = 0;
	}
	for (int i = 0; i < words.size(); i++) {
		if (most_long < words[i].size()) {
			most_long = words[i].size();
			longest_word = words[i];
		}
	}
	cout << mo_ma_word <<' '<<longest_word<<endl;
}

C++:  
 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 
 using namespace std;
  
 int main()
 {
   multiset<string> kk;
   int max=0;
   int fre=-100000000;
   string str;
   string str_max;
   string str_fre;
   multiset<string>::iterator iter; 
   while(cin>>str)
   {
     if(str.length()>max) 
     {
       max=str.length();
       str_max=str;                     
     }             
     kk.insert(str);      
   }              
   for(iter = kk.begin();iter!= kk.end(); iter++)  
   {  
     string str=*iter;
     int num=kk.count(str);
     if(num>fre) 
     {
       fre=num;
       str_fre=str;                
     }
   }  
   cout<<str_fre<<" "<<str_max<<endl;
   //while(1);     
   return 0;  
 }

C++: #include <bits/stdc++.h>
 
using namespace std;
 
/*-------------------------------*/
#define FOR(i, a, b) for(int i = (a); i < (b); i++) 
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; i--)
#define all(i) (i).begin(),(i).end()
#define pb push_back
#define mp make_pair 
 
typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<long long> llv;
typedef vector<pint> vpint;
/*-------------------------------*/
 
int main(void)
{
  map<string, int> m;
  string x = "", s, y = "";

  while (cin >> s){
    m[s] += 1;
    if (m[x] < m[s]) x = s;
    if (y.size() < s.size()) y = s;
  }

  cout << x << " "  << y << endl;
  
  return 0;
}

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

using namespace std;

int main(){
  string s;
  string max;
  int maxsize  = 0;
  map <string, int> m;
  while(cin >> s)
  	m[s]++;
   if(s.size() > maxsize){
       max = s;
       maxsize = s.size();
   }

   map<string,int>::iterator it = m.begin();
   string freq;
   int maxfreq = 0;
   for(it; it != m.end();it++){
   	 int k = (*it).second;
   	  if(k > maxfreq ){
   	  	maxfreq = k;
   	  	freq = (*it).first;
   	  }
   }
   cout << freq << " " << max;

   return 0;
 }

C++: #include <stdio.h>
#include<math.h>
using namespace std;

#define SIZE 1001

int main(){
	char buf[SIZE],longest[33],most_appear[33],tmp[33];
	fgets(buf,SIZE,stdin);
	int max_appear = -1,max_length = -1,tmp_length,tmp_count;

	for(int i=0,k=0;buf[i] != '\0';){	//?§????????????????
		tmp_length = 0;
		tmp_count = 0;
		for(k=i;buf[k] != '\0' && buf[k] != ' ';k++){
			tmp[0+(k-i)] = buf[k];
			tmp_length++;
		}
		if(max_length < tmp_length){ //??????????????´??°
			for(int p=0;p < tmp_length;p++){
				longest[p] = tmp[p];
				longest[p+1] = '\0';
			}
			max_length = tmp_length;
		}
		//??????????????????
		for(int p=0;buf[p] != '\0';){
			int t,match_count=0;
			for(t=0;buf[p+t] != '\0' && buf[p+t] != ' ' && t < tmp_length;t++){
				if(buf[p+t] == tmp[t] || buf[p+t] == tmp[t]-32 ||  buf[p+t] == tmp[t]+32){
					match_count++;
				}
			}
			if(match_count == tmp_length && buf[p+t] == ' ')tmp_count++;
			if(buf[p+t] != '\0'){
				p += (t+1);
			}else{
				break;
			}
		}
		if(max_appear < tmp_count){	//??????????????´??°
			for(int p=0;p < tmp_length;p++){
				most_appear[p] = tmp[p];
				most_appear[p+1] = '\0';
			}
			max_appear = tmp_count;
		}
		if(buf[k] != '\0'){
			i = k+1;
		}else{
			break;
		}
	}

	printf("%s %s",most_appear,longest);

    return 0;
}

C++: #include <iostream>
#include <string>
#include <map>
using namespace std;
map<string,int> table;
int main(){
    string str;
    string maxLen, maxT;
    while(cin >> str)
	{
        (table[str])++;
        if(table[maxT] < table[str])
		{
            maxT = str;
		}
        if(maxLen.size() < str.size())
		{
            maxLen = str;
		}
    }
    cout << maxT << ' ' << maxLen << endl;    
}

C++: #include<iostream>
#include<string>
#include<vector>
struct data_set
{
	std::string str;
	int appearance, length;
	data_set(const std::string&_str)
	{
		str = _str;
		for (auto&i : str)
		{
			if ('A' <= i && i <= 'Z')
			{
				i += 'a' - 'A';
			}
		}
		appearance = 1;
		length = static_cast<int>(str.length());
	}
};
int main()
{
	std::vector<data_set>data_sets;
	std::string word;
	std::cin >> word;
	data_sets.push_back(data_set(word));
	while (std::cin >> word)
	{
		bool new_word = true;
		for (auto&i : data_sets)
		{
			new_word &= i.str != data_set(word).str;
			if (!new_word)
			{
				i.appearance++;
				break;
			}
		}
		if (new_word)
		{
			data_sets.push_back(data_set(word));
		}
	}
	int mode = 0, longest = 0, mode_i, longest_i;
	for (int i = 0; i < data_sets.size(); i++)
	{
		if (mode < data_sets[i].appearance)
		{
			mode = data_sets[i].appearance;
			mode_i = i;
		}
		if (longest < data_sets[i].length)
		{
			longest = data_sets[i].length;
			longest_i = i;
		}
	}
	std::cout << data_sets[mode_i].str << ' ' << data_sets[longest_i].str << std::endl;
	return 0;
}

C++: #include <iostream>
#include <string>
#include <map>
using namespace std;
int M,l;int 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<cstdio>
#include<cstring>

using namespace std;

char moji[10000][1000] = {{0}}; int mojis = 0;

int main(void)
{
	
	int i = 0;

	int m_cnt[1000] = {0},m_cnts = 0;
	int m_cntss = 0;

	char a[10000] = {0};
	scanf("%[^\n]",a);
	int as = strlen(a);

	int m_long = 0,m_longs;
	kitune:;//kariの初期化
	char kari[10000] = {0}; int karis = 0;
	while(i < as)
	{
		if(a[i] == ' ' || i == as - 1)
		{
			if(i == as -1) kari[karis] = a[i];
			int k_flag = 0;
			for(int j = 0;j < mojis;j++)
			{
				if(strcmp(&moji[j][0],kari) == 0) 
				{
					m_cnt[j]++;
					k_flag = 1;
					break;
				}
			}

			if(k_flag == 0)
			{
				strcpy(moji[mojis],kari);
				if(m_long < strlen(moji[mojis]))
				{
					m_long = strlen(moji[mojis]);
					m_longs = mojis;
				}
				mojis++;
			}
			i++;
			goto kitune;
		}
		else
		{
			kari[karis] = a[i];
			karis++;
			i++;
		}
	}

	for(int k = 0;k < mojis;k++)
	{
		if(m_cnts < m_cnt[k])
		{
			m_cnts = m_cnt[k];
			m_cntss = k;
		}
	}

	printf("%s %s\n",&moji[m_cntss][0],&moji[m_longs][0]);
	return 0;
}