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 <vector>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cmath>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(x=from;x<to;x++)

using namespace std;

typedef pair<string,int> mypair;

int main(void){
vector< mypair> vvc(1,mypair("",0));
string wst, qst="", mst;

	while(cin >> wst){
		if(wst.size() > qst.size()) qst = wst;
		int sszz=vvc.size();
		bool addsw = true;
		rep(i,sszz){
			if(wst == vvc[i].first){
				vvc[i].second++;
				addsw=false;
				break;
			}
		}
		if(addsw) vvc.push_back(mypair(wst,1));
	}
	int mx = -999, sszz = vvc.size();
//	rep(i,sszz) cout << i << ": " << vvc[i].first << "- " << vvc[i].second << endl;
	rep(i,sszz){
		if(mx < vvc[i].second){
			mx = vvc[i].second;
			mst = vvc[i].first;
		}
	}
	cout <<  mst << " " << qst << endl;
	return 0;
}

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

int main(void){


    string str,ans1,ans2;
    map<string,int> dict;
    int maxi = 0;
    while(cin >> str){
        if(maxi < str.size()){
            maxi = str.size();
            ans1 = str;
        }
        dict[str]++;
        int count = 0;
        map<string,int>::iterator itr;
        for(itr = dict.begin();itr != dict.end();itr++){
            if(count < (*itr).second){
                ans2 = (*itr).first;
                count = (*itr).second;
            }
        }
    }
    cout << ans2 << " " << ans1 << endl;
    return 0;
}

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

using namespace std;

const int M = 33;
const int N = 1001;

char text[N];
char word[N][M];
char tmp[M], ansm[M], ansl[M]; 

int cmp(const void *a, const void *b) {
	return strcmp((char *)a, (char *)b);
}

void solve(char text[]) {
	int len = strlen(text);
	for (int i=0; i<len; ++i) {
		if (text[i] >= 'A' && text[i] <= 'Z') text[i] = text[i] - 'A' + 'a';
	}
	int j = 0, k = 0;
	for (int i=0; i<len; ++i) {//分解文章 
		if (text[i] != ' ') word[k][j++] = text[i];
		else {
			if (j == 0) continue;
			word[k++][j] = '\0', j = 0;
		}
	}
	if (j) word[k++][j] = '\0';
	qsort(word, k, sizeof(word[0]), cmp);
	int maxs = -1;
	int cnt = 1;
	strcpy(tmp, word[0]);
	strcpy(ansl, word[0]);
	int maxl = strlen(word[0]);
	for (int i=1; i<k; ++i) {
		if (maxl < strlen(word[i])) maxl = strlen(word[i]), strcpy(ansl, word[i]);
		if (!strcmp(tmp, word[i])) ++cnt;
		else {
			if (maxs < cnt) {
				maxs = cnt;
				strcpy(ansm, tmp);
			}
			strcpy(tmp, word[i]);
		}
	}
	if (maxs < cnt) strcpy(ansm, tmp);
}

int main() {
	while (cin.getline(text, N, '\n')) {
		solve(text);
		cout<<ansm<<" "<<ansl<<endl;
	}
	return 0;
}

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

int main() {
	vector<string> words;
	string stock;

	while (cin >> stock) {
		words.push_back(stock);
	}

	vector<int> times(words.size(), 0);
	
	for (unsigned int i = 0;i < words.size();i++) {  //times??????????????°????¨????
		for (unsigned int j = i;j < words.size();j++) {
			if (words.at(i) == words.at(j)) times.at(i)++;
		}
	}

	int mode_times = 0;//?????§???????????°
	int mode_num;  //?????§??????????????????

	for (unsigned int i = 0;i < times.size();i++) {
		if (times.at(i) > mode_times) {
			mode_times = times.at(i);
			mode_num = i;
		}
	}//??????

	int max_length = 0;
	int max_num;

	for (unsigned int i = 0;i < words.size();i++) {
		if (words.at(i).length() > max_length) {
			max_length = words.at(i).length();
			max_num = i;
		}
	} //??????

	cout << words.at(mode_num) << " " << words.at(max_num) << endl;
	
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  map<string,int>a;
  string s,p,q;
  int k=0;
  while(cin>>s){
    a[s]++;
    if(p.size()<s.size())p=s;
    if(k<a[s]){
      k=a[s];
      q=s;
    }
  }
  cout<<q<<' '<<s<<endl;
}

C++: #include<iostream>
#include<string>
#include<map>
using namespace std;
int main()
{
	string s, mode, longest;
	typedef map<string, int> dic_t;
	dic_t dic;
	while (cin >> s) {
		if (++ dic[s] > dic[mode])
			mode = s;
		if (s.size() > longest.size())
			longest = s;
	}
	cout << mode << ' ' << longest << endl;
	return 0;
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <queue>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int gcd(int a, int b){
   int tmp;
   while(a%b==0){
      tmp=a%b;
      a=b;
      b=tmp;
   }
}

int lcm(int a,int b){
   return a*b/gcd(a,b);
}

bool prime_number(int n){
   vector<bool> i;
   if(n < 2){
      return false;
   }
   else if(n == 2){
      return true;
   }
   if(n % 2 == 0){
      return false;
   }
   for(int i=3;i<=n/i;i+=2){
      if(n % i == 0) return false;
      return true;
   }
}

int main(){
   vector<string> s;
   string a,ans1,ans2;
   int tmp, f=0, l=0;
   while(cin>>a) s.PB(a);
   REP(i,s.size()){
      tmp=count(ALL(s),s[i]);
      if(f<tmp){
         f=tmp;
         ans1=s[i];
      }
      if(l<s[i].size()){
         l=s[i].size();
         ans2=s[i];
      }
   }
   cout << ans1 << " " << ans2 << endl;
}

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

using namespace std;

int main(){
	
	string str[2000];
	
	int n;
	
	n = 10;
	
	for(int i = 0; i < 1000; i++){
		cin >> str[i];
		if(cin.eof()){
			n = i + 1;
			break;
		}
	}
	
	int max_size, max_num, sum, ans_size, ans_num;
	
	max_size = 0;
	max_num = 0;
	
	for(int i = 0; i < n; i++){
		if(str[i].size() > max_size){
			ans_size = i;
			max_size = str[i].size();
		}
		
		sum = 0;
		
		for(int j = 0; j < n; j++){
			if(str[i] == str[j]){
				sum++;
			}
		}
		
		if(sum > max_num){
			max_num = sum;
			ans_num = i;
		}
	}
	
	cout << str[ans_num] << " " << str[ans_size] << endl;
	
	return 0;
}