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

int main(){
  int m=0,f=0;
  multiset<string> a;
  string s,ms,mf;
  while(cin>>s){
    a.insert(s);
    if(m<s.size())ms=s;m=s.size();
    if(f<a.count(s))mf=s;f=a.count(s);
  }
  cout<<f<<" "<<m;////////
  cout<<mf<<" "<<ms<<endl;
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <string>

using namespace std;

int main()
{
  string s[1001], ms, fs, ss;
  int m = 0, c, i = 0;
  getline(cin, ss);
  stringstream gs(ss);
  while(gs >> s[i]){
    if(s[i].size() > m){
      m = s[i].size();
      ms = s[i];
    }
    i++;
  }
  for(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 <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <map>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define PB push_back
#define MP make_pair
typedef pair<double,double> P;
int main(){
  map<string,int> data;
  string s;
  int cnt=0,t=0,m=0;
  string ans[2];
  while(cin>>s){
    data[s]++;
    if(data[s]>t){
      t=data[s];
      ans[0]=s;
    }
    if(s.size()>m){
      m=s.size();
      ans[1]=s;
    }
  }
  cout<<ans[0]<<" "<<ans[1]<<endl;
}

C++: #include<iostream>
#include<algorithm>
#include<stdio.h>
#include<string>
using namespace std;
int main()
{
	string p[1001],s;
	int c;
	int st[1001] = { 0 }, l = 0, i,maxl=0,maxn=0;
	while ((c = getchar()) != '\n'){
		if (c == ' '){
			for (i = 0; i < l; i++){
				if (p[i] == s){
					st[i]++;
					s.clear();
					break;
				}
			}
			if (i == l){
				int size = s.size();
				p[l] = s;
				maxl = max(maxl,size);
				if (maxl == s.size())maxn = l;
				s.clear();
				l++;
			}
		}
		else{
			s += c;
		}
	}
	for (i = 0; i < l; i++){
		if (p[i] == s){
			st[i]++;
			break;
		}
	}
	if (i == l){
		int size = s.size();
		p[l] = s;
		maxl = max(maxl, size);
		if (maxl == s.size())maxn = l;
		s.clear();
		l++;
	}
	int maxb=0,maxnum;
	for (int i = 0; i < l; i++){
		maxb = max(maxb, st[i]);
		if (maxb == st[i]){
			maxnum = i;
		}
	}
	cout << p[maxnum] << " ";
	cout << p[maxn] << endl;
}

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;

  return 0;
}

C++: #include<iostream>
#include<map>
#include <algorithm>
using namespace std;
int main() {
  map<string, int> word;
  string s, s1 = "", s2 = "";
  int a = 0;
  while (cin >> s)
    word[s]++;
  for (auto e: word) {
    if (a < e.second) s1 = e.first;
    if (s2.size() < e.first.size()) s2 = e.first;
  }
  cout << s1 << ' ' << s2 << endl;
  return 0;
}

C++: #define scanf_s scanf
#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 1001
#define MIN -100001
#define _MAX 100
int main(void)
{
	int x, max = 0, max_n = 0, cou = 0, word_num[MAX / 2] = { 0 }, m_i, m_j;
	string word[MAX / 2];
	char str[MAX];
	gets_s(str);
	for (int i = 0; str[i] != '\0'; ++i) {
		for (int j = 0; str[i] != ' '; ++j, ++i) {
			word[cou][j] = str[i];
		}
		++cou;
	}
	for (int i = 0; i < cou; ++i) {
		if (word[i].size > max) {
			max = word[i].size; m_i = i;
		}
		for (int j = 0; j < i; ++j) {
			if (word[i] == word[j]) {
				++word_num[j];
				if (word_num[j] > max_n) { max_n = word_num[j]; m_j = j; }
			}
		}
	}
	cout << word[m_i] << " " << word[m_j] << "\n";
}

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

int main()
{
    string field;
    map<string, int> mp;
    string frequently_word;
    string max_num_word;
    int freq_count = 0;
    int max_letter_num = 0;

    while (cin >> field)
    {
        /* store the word which has the maximum number */
        if(field.size() > max_letter_num)
        {
            max_num_word = field;
        }
        /* search the word from map */
        if(mp.count(field)) 
        {
            mp[field]++; 
        }
        else
        {
            mp[field] = 1;
        }
 
    }
    /* get the most frequently word */
    for(auto itr = mp.begin(); itr != mp.end(); ++itr)
    {
        if(itr->second > freq_count)
        {
            frequently_word = itr->first;
        }
    }
    cout << frequently_word << " " << max_num_word << endl;

    return 0;
}

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

using namespace std;

int main() {
    int maxlen = 0, maxcount = 0;
    string s, lens, counts;
    map<string, int> mp;
    while (cin >> s) {
        if (maxlen < s.size()) {
            maxlen = s.size();
            lens = s;
        }
        mp[s]++;
        if (maxcount < mp[s]) {
            maxcount = mp[s];
            counts = s;
        }
    }
    cout << counts << " " << lens << endl;
    
    return 0;
}

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

int main(void) {
  string str;   // 入力される原文
  getline(cin, str);
  stringstream sstr(str);  // sstrをstrで初期化
  vector<string> word;   // 出てきた単語を重複しないように保持するためのvecor
  vector<int> count;   // 出てきた単語の回数を保持するためのvector
  bool check;   // 出てきた単語が既出かどうかを判断するためのbool
  
  while(sstr >> str) {   // sstrからstrに単語ごとに代入される。strは毎回リセットされる。
    check = false;
    for(int i = 0; i < word.size(); ++i) {
      if(str == word[i]) {
        ++count[i];
        check = true;
      }
    }
    if(! check) {
      word.push_back(str);
      count.push_back(1);
    }
  }
  
  int often = 0;
  for(int i = 0; i < count.size(); ++i) {
    if(count[often] < count[i]) {
      often = i;
    }
  }
  cout << word[often] << " ";
  
  string longest = "";
  for(int i = 0; i < word.size(); ++i) {
    if(longest.size() < word[i].size()) {
      longest = word[i];
    }
  }
  cout << longest << endl;
}