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 <sstream>
#include <string>
#include <map>
using namespace std;
int main( void )
{
	map <string, int> TABLE;

	int max_length = 0;
	string max_length_word = "";
	int max_count = 0;
	string max_count_word = "";

	string text;
	string word;
	getline( cin, text );
	istringstream is( text );

	while ( is >> word )
	{
		if ( word.length() > max_length )
		{
			max_length_word = word;
			max_length = word.length();
		}

		if ( TABLE.find( word ) == TABLE.end() )
		{
			TABLE[word] = 0;
		}
		else
		{
			TABLE[word]++;
			if ( TABLE[word] > max_count )
			{
				max_count_word = word;
				max_count = TABLE[word];
			}
		}
	}

	cout << max_count_word << " " << max_length_word << endl;

	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;
typedef vector<string> vs;
/*-------------------------------*/
 
int main(void)
{
  vs s;
  string a, smax;
  cin >> smax;
  while (cin >> a){
    if (a.size() > smax.size()) smax = a;
    s.pb(a);
  }

  string x = s[0];
  int bcnt = 0;
  FOR(i, 0, s.size()){
    int cnt = 0;
    FOR(j, 0, s.size()){
      if (s[i] == s[j]) cnt++;
    }
    if (i == 0) bcnt = cnt;
    if (bcnt < cnt) x = s[i];
    bcnt = cnt;
  }
  cout << x << " " << smax << endl;

  return 0;
}

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

struct DataBox
{
	int frequentCount;
	int maxLength;
	string frequentWord;
	string maxLengthWord;

	DataBox() : frequentCount(0), maxLength(0)	/* constructer */
	{
	}
};

int main(void)
{
	struct DataBox dataBox;
	string sentence;
	int count = 0;

	int maxSentenceWord = 1000;
	int maxWord = 32;
	int sentenceWordCount = 0;
	int wordCount = 0;
	string wordBox[1000];

	while(cin >> sentence)	/* input */
	{
		sentenceWordCount++;
		
		/* check */
		wordCount = (int)sentence.size();
		if(dataBox.maxLength < wordCount)
		{
			dataBox.maxLength = wordCount;
			dataBox.maxLengthWord = sentence;
		}

		wordBox[count] = sentence;
		count++;
	}

	/* check */
	int freCount = 0;
	for(int boxNum = 0; boxNum < count; boxNum++)
	{
		string str = wordBox[boxNum];
		for(int word = 0; word < count; word++)
		{
			if(str == wordBox[word])
			{
			    freCount++;
			}
			
			if(dataBox.frequentCount < freCount)
			{
				dataBox.frequentCount = freCount;
				dataBox.frequentWord = str;
			}  
		}
		freCount = 0;
	}

	cout << dataBox.frequentWord << ' ' << dataBox.maxLengthWord << endl;
	return 0;
}

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

using namespace std;

int main()
{
	map<string,int> mp;
	string s;
	while(cin>>s){
		if(mp.count(s)==0)	mp.insert(make_pair(s,1));
		else				mp.find(s)->second++;
	}
	int fmax=0,lmax=0;
	string sfmax,slmax;
	map<string,int>::iterator it;
	for(it=mp.begin();it!=mp.end();it++){
		if(fmax<it->second)			sfmax=it->first,fmax=it->second;
		if(lmax<it->first.length())	slmax=it->first,lmax=it->first.length();
	}
	cout<<sfmax<<" "<<slmax<<endl;
	return 0;
}

C++: #include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
using namespace std;

int main(){
	char mat[50];
	map<string,int> table;
	int maxi=0;
	string longest="",most="";
	while(scanf("%s",mat)!=EOF){
		string word(mat);
		table[word]++;
		if(table[word]>maxi){
			maxi = table[word];
			most = word;
		}
		if(word.size()>longest.size()){
			longest = word;
		}
	}
	cout<<most<<" "<<longest<<endl;
	return 0;
}

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

using namespace std;

int main(){
    string str, mostfind = "", mostlong = "";
    map<string, int> many;
    while(cin >> str){
        if(many[mostfind] < ++many[str]){
            mostfind = str;
        }
        if(mostlong.size() < many.size()){
            mostlong = str;
        }
    }
    cout << mostfind << " " << mostlong << "\n";
}

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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)):((m)-(n))),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)
#define loop for(;;)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;
typedef vector<int> vi;
typedef vector<string> vs;
typedef map<string,int> Dictionary;
const Real PI = acos(-1);

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  if (v.size() == 0) {
    os << "(empty)";
    return os;
  }
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

int main() {

  Dictionary d;

  int freq = 0;
  string longest = "";
  int longest_length = 0;

  for (string s; cin>>s, cin;) {
    d[s]++;
    freq = max(freq, d[s]);
    if (longest_length < s.size()) {
      longest = s;
      longest_length = s.size();
    }
  }

  string most_freq;
  for (auto&p : d) {
    if (freq == cdr(p)) {
      most_freq = car(p);
      break;
    }
  }

  cout << most_freq << ' ' << longest << endl;

  return 0;
}

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

using namespace std;

int main()
{
  string s[1001], ms, fs;
  int m, c;
  for (int i = 0, m = 0; (c = getchar()) != EOF; i++){
      cin >> s[i];
      if(s[i].size() > m){
	m = s[i].size();
	ms = s[i];
      }
  }
  for(int i = 0, c = 0; i < 1001; i++){
    for(int j = i + 1; j < 1001; j++){
      if(s[i].compare(s[j]) == 0){
	int nc = 0;
	nc++;
	if(nc > c){
	  c = nc;
	  fs = s[i];
	}
      }
    }
  }
  cout << fs << " " << ms << endl;
  return 0;
}

C++: //#include<bits/stdc++.h>
#include<iostream>
#include <vector>
#include <cstdio>
#include<algorithm>
#include <utility>
#include<string>
using namespace std;
string str[33] = { "" };
char ch[10001];
int input();
int main() {
	int a,most=0;
	a = input();
	string  longest;
	int m[33] = { 0 }, l;
	for (int i = 0; i <= a + 1; i++) {
		for (int j = i + 1; j <= a; j++) {
			if (str[i] == str[j]) {
				m[i]++;
			}
		}
	}int k,ma=0,locate,memo;
	for (k = 0; k <= a+1; k++) {
		if (m[k] > ma) {
			ma = m[k];
			locate= k;
		}
	}
	for (int f = 0; f <= a+1; f++) {
		if (str[f].size()> most) {
			most = str[f].size();
			memo = f;
		}
	}
	longest = str[memo];
	cout << str[locate] << " " << longest << endl;
	return 0;
}
int input() {
	int i = 0, j = 0;
	while (1) {
		scanf("%c", &ch[i]);
		if (isupper(ch[i])) {
			ch[i] += 'a' - 'A';
		}
		if (ch[i] == ' ') {
			j++;
		}
		else if (ch[i] == '\n') {
			break;
		}
		else {
			str[j] += ch[i];
		}
		
	}
	return j;
}