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 <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

int main() {
map<string,int> msi;
string s;
int ma=0;
int ma2=0;
string ans;
string ans2;
while (cin >> s){
	if (EXIST(msi,s))
		msi[s]=1;
	else{
		msi[s]++;
		if (ma2<msi[s]){
		ans2=s;
		ma2 = msi[s];
		}
		}
	if (ma < s.length()){
	ans=s;
	ma = s.length();
	}
}
cout << ans2 << " "<<ans<<endl;
	return 0;
}

C++: #include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=9000000009;

signed main(){
  map<string,int> mp;
  string s;
  getline(cin,s);
  string maxsent="";
  REP(i,s.size()){
    string t;
    while(s[i]!=' '){
      t+=s[i];
      i++;
    }
    mp[t]++;
    if(maxsent.size()<t.size())maxsent=t;
  }
  string mostsent;
  int mode=0;
  for(auto x:mp){
    if(x.SC>mode){
      mode=x.SC;
      mostsent=x.FR;
    }
  }
  cout<<mostsent<<' '<<maxsent<<endl;
  return 0;
}

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

int main(){
  std::string str;
  std::string maxlen;
  std::string maxocc;
  std::map<std::string, int> occ;
  //std::cin >> str;
  //std::cout << str << std::endl;

  std::cin >> str;
  maxlen = str;
  maxocc = str;

  while(std::cin >> str){
    if(str.size()>maxlen.size()){
      maxlen = str;
    }
    occ[str]++;
    if(occ[str]>occ[maxocc]){
      maxocc = str;
    }
  }

  std::cout << maxlen << std::endl;
}

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

int main(){
    map<string,int>M;
    string in,ma,ma2;
    while(cin>>in){
        M[in]++;
        if(ma.size()<in.size())ma=in;
    }

    for(map<string,int>::iterator it=M.begin();it!=M.end();it++){
        ma2=it->first;
    }
    cout<<ma2<<" "<<ma<<endl;

    return 0;
}

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

int main(){
	string s;
	string longest = "";
	int most = 0;
	string most_str;
	map<string, int> h;
	while(cin >> s){
		if(s.size() > longest.size()){
			longest = s;
		}
		if (h.find(s) == h.end()) {
			h[s] = 0;
		}
		h[s]++;
		if (most < h[s]) {
			most = h[s];
			most_str = s;
		}
	}
	cout << most_str << " " << longest << 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[1000];
  int cnt=0;
  while(cin>>s[cnt]){
    if(data[s[cnt]]==1)data[s[cnt]]++;
    else data[s[cnt]]=1;
    cnt++;
  }
  string ans[2];
  int m[2]={0,0};
  for(int i=0;i<cnt;i++){
    if(s[i].size()>m[1]){
      ans[1]=s[i];m[1]=s[i].size();
    }
    if(data[s[i]]>m[0]){
      ans[0]=s[i];m[0]=data[s[i]];
    }
  }
  cout<<ans[0]<<" "<<ans[1]<<endl;
}

C++: //
//  main.c
//  EngSent
//
//  Created by x16017xx on 2016/11/10.
//  Copyright ?? 2016??´ AIT. All rights reserved.
//

#include <stdio.h>
#include <string.h>

int main(int argc, const char * argv[]) {
    char str[1000][33]={};
    int strId[1000]={};
    char strTmp[33]={};
    int i, j, l = 0;
    int mt=0;
    int cm=0;
    int mm=0;
    char ch;
    // ???????????\???
    for(i=0;i<1000;i++){
        scanf("%c", &ch);
        if(ch==' '||ch=='\n'){
            strTmp[l]='\0';
            for(j=0;strcmp(str[j],"\0")!=0;j++){
                if(0==strcmp(str[j], strTmp)){
                    l=0;
                    break;
                }
            }
            strcpy(str[j], strTmp);
            strId[j]++;
            l=0;
            if(ch=='\n'){
                break;
            }
        }else{
            strTmp[l]=ch;
            l++;
        }
    }
    
    // ????????°????????????????????????
    for(i=0;strcmp(str[i],"\0")!=0;i++){
        if(mt<strId[i]){
            mt=strId[i];
        }
    }
    for(i=0;strcmp(str[i],"\0")!=0;i++){
        if(mt==strId[i]){
            printf("%s ",str[i]);
        }
    }
    // ????????°????????????????????????
    for(i=0;strcmp(str[i],"\0")!=0;i++){
        cm=(int)strlen(str[i]);
        if(mm<cm){
            mm=cm;
        }
    }
    for(i=0;strcmp(str[i],"\0")!=0;i++){
        if(mm==strlen(str[i])){
            printf("%s\n",str[i]);
        }
    }
    return 0;
}

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

using namespace std;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  map<string, int> word;
  string str;
  string lon = "", w = "";
  int cmax = 0;

  while (cin >> str){
    if (str.size() > lon.size()){
      lon = str;
    }
    word[str]++;
  }

  map<string, int>::iterator it = word.begin();
  
  while (it != word.end()){
    if (cmax < (*it).second){
      cmax = (*it).second;
      w = (*it).first;
    }

    
    ++it;
  }

  cout << w << ' ' << lon << endl;

  return (0);
}

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

int main(){
	map<string,int> mp;
	string str,tmp[1111];
	getline(cin,str);
	istringstream ss(str);
	int i=0;
	while(getline(ss,tmp[i],' ')){
		mp[tmp[i]]++;
	}
	map<string,int>::iterator itr;
	int ans=0,len=0;
	string s1,s2;
	for(itr = mp.begin(); itr != mp.end(); ++itr) {
	   	string w = itr->first;
    	int c = itr->second;
    	if(c > ans) {
    		ans = c;
    		s1 = w;
    	}
    	int s = w.size();
    	if(s > len) {
    		len = s;
    		s2 = w;
    	}
	}
	cout << s1 << " " << s2 << endl;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main()
{
    map<string, int> mp;
    string w, word;
    while (cin >> word) {
        mp[word]++;
        if (w.size() < word.size()) {
            w = word;
        }
    }
    
    for (auto &x: mp) {
        word = x.first;
    }
    cout << word << " " << w << endl;
    return 0;
}