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 <stddef.h>
#include <iostream>
#include <map>
#include <string>
#include <utility>
using namespace std;
int main() {
  map<string, int> word;
  string s, s1 = "", s2 = "";
  int a = 0;
  size_t b = 0;
  while (cin >> s)
    word[s]++;
  for (auto e : word) {
    if (a < e.second) {
      s1 = e.first;
      a = e.second;
    }
    if (b < e.first.size()) {
      s2 = e.first;
      b = e.first.size();
    }
  }
  cout << s1 << ' ' << s2 << endl;
  return 0;
}

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