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 <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.es", "r", stdin);
	string str = "";

	while ( getline (cin, str ) ){

		map <string, int> freq, leng;
		if (str.find('.') != string::npos){
			str = str.erase (str.find('.'), 1);
		} // end if
		stringstream ss(str);
		string s = "";

		while (ss >> s){
			++freq[s];
			leng[s] = s.length();
		} // end while

		if (freq.size() == 2){
			cout << "The two words separated by a space." << endl;
			continue;
		}else{ 
			multimap <int, string, greater<int> > rank;
			map <string, int>::iterator itf = freq.begin();
			for (; itf != freq.end(); ++itf){
				rank.insert (make_pair ((*itf).second, (*itf).first ) );
			} // end for
			multimap<int, string, greater<int> > mlen;
			map<string, int>::iterator itl = leng.begin();
			for (; itl != leng.end(); ++itl){
				mlen.insert (make_pair ((*itl).second, (*itl).first ) );
			} // end for
			multimap<int, string, greater<int> >::iterator itr = rank.begin();
			multimap<int, string, greater<int> >::iterator itm = mlen.begin();
			cout << (*itr).second << ' ' << (*itm).second << endl;
		} // end if		

	} // end while
		
	return 0;
}

C++: //0029 English Sentence
//pêÌ¶ÍÅo»·éPêðÇÝæèAo»pxªÅà¢PêÆAàÁÆà·¢PêðoÍµÄI¹¹æ
//üÍf[^ÍAAt@xbgÆXy[XÌÝªÜÜêé
//¶ÍÌ¶Í1000¶ÈºÅA1PêÌ·³Í32¶ÈºÅ·
//Ü½Ao»pxªÅà¢PêÆÅà·¢PêÍA»ê¼ê¶ÉêÂµ©¶ÝµÈ¢

#include<iostream>
#include<string>
#include<map>
#include<limits>
#include<algorithm>
using namespace std;

int main(void)
{
	typedef map<string, int> Map;
	Map m;
	string str;
	Map::iterator s;
	int maxSize = numeric_limits<int>::min();
	while( cin >> str)
	{
		m[str]++;
		if( maxSize < (int)str.size())
		{
			maxSize = str.size();
			s = m.find(str);
		}
	}
	
	Map::iterator mode = m.begin();
	for(map<string, int>::iterator ite = m.begin();
		ite != m.end();
		++ite)
	{
		if(mode->second < ite->second)
			mode = ite;
	}
	cout << mode->first << ' ' << s->first << endl;
	return 0;
}

C++: <?php

$line = strtolower(trim(fgets(STDIN)));
$arr = explode(" ", $line);

$maxword = "";
$maxlenword = "";
$hash = array();
foreach($arr as $word){
	$hash[$word]++;
	
	if($hash[$maxword] < $hash[$word]){
	 	$maxword = $word;
	}
	if(strlen($maxlenword) < strlen($word)){
		$maxlenword = $word;
	}
}

echo "{$maxword} {$maxlenword}\n";

C++: #include<iostream>
#include<map>
#include<cstring>
#include<algorithm>

using namespace std;

int main(void){
  char s[1001][33];
  map<string,int>wd;
  int i=0;

  while(~scanf("%s",&s[i][0])){i++;}

  for(int j=0;j<i;j++)
    wd[s[j]]=0;

  for(int j=0;j<i;j++)
    wd[s[j]]++;

  int ans=0,len=0;
  for(int j=0;j<i;j++){
    ans=max(wd[s[j]],ans);
    len=max(len,(int)strlen(&s[j][0]));
  }

  string s1,s2;
  for(int j=0;j<i;j++){
    if(ans==wd[s[j]])s1=s[j];
    if(len==strlen(s[j]))s2=s[j];
  }
  cout << s1 << " " << s2 << endl;
  return 0;
}

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

int main()
{
	std::map<std::string, int> word_frequency;
	std::string word;
	while (std::cin >> word) {
		word_frequency[word]++;
	}

	std::string most_frequent_word;
	std::string longest_word;
	int max_frequency = 0;
	for (std::map<std::string, int>::iterator i = word_frequency.begin(); i != word_frequency.end(); ++i) {
		if (i->second > max_frequency) {
			most_frequent_word = i->first;
			max_frequency = i->second;
		}
		if (i->first.size() > longest_word.size()) {
			longest_word = i->first;
		}
	}

	std::cout << most_frequent_word << ' ' << longest_word << std::endl;

	return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    string input, longest, many;
    int len = 0, count = 0;;
    map<string, int> wordCount;
    while(cin >> input){
        if(len < input.size()){
            len = input.size();
            longest = input;
        }
        wordCount[input]++;
        if(count < wordCount[input]){
            count = wordCount[input];
            many = input;
        }
    }
    cout << many << ' ' << longest << endl;
}

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

using namespace std;

int main( ){
    string l;
    int t=0;
	string max="";
	map<string,int> str;
	string s;
	while(cin>>s){
            if(s.length()>max.length())max=s;
            str[s]++;
            if(str[s]>t){
                t=str[s];
                l=s;
            }
	}
	cout<<l<<" "<<max<<endl;
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<map>
using namespace std;
int main()
{
    char a[1005];
    string b,c;
    int i,j;
    while(gets(a))
    {
        map<string,int>M;
        int len = strlen(a);
        string s;
        s="";
        int m = -1,g=-1,gg=-1;
        j=0;
        for(i=0;i<len;i++)
        {
            if(a[i]==' ')
            {
                if(M[s]==0)
                  M[s]++;
                else M[s]++;
                if(g>gg)
                {
                    gg=g;
                    c=s;
                    //cout<<g<<" "<<s<<endl;
                }
                if(M[s]>m)
                {
                    m=M[s];
                    b=s;
                }
                s="";
                g=0;
            }
            else if((a[i]>='a'&&a[i]<='z')||(a[i]>='A'&&a[i]<='Z'))
            {
                s+=a[i];
                g++;
            }
        }
        if(g>gg)
        {
            gg=g;
            c=s;
            //cout<<g<<" "<<s<<endl;
        }
        if(M[s]>m)
        {
            m=M[s];
            b=s;
        }
        cout<<b<<" "<<c<<endl;
    }
}

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

int main() {
  int k=0,times[1000] = {0},top,topsoeji,hantei,sizetop,sizetopsoeji,size[1000] = {0};
  char word[1000][32];
  string str;
  while (cin >> str) {
    //cout << str.size();
    for(int i=0;i<str.size();i++) {
      //      word[k][i] = str.substr(i,1);
      word[k][i] = str[i];
      size[k] = str.size();
      if(size[k] > sizetop) {
        sizetop = size[k];
        sizetopsoeji = k;
      }
    }
    //cout << word[k] << endl;
    k++;
  }


  for(int i=0;i<k;i++) {
    for(int j=i+1;j<k;j++) {
      if(strcmp(word[i],word[j]) == 0)
        hantei = 1;
      else
        hantei = 0;
      if(hantei) {
        times[i]++;
        times[j]++;
      }
    }
  }
  //  for(int i=0;i<k;i++)
    //  cout << times[i] << endl;

  top = times[0];
  topsoeji = 0;
  for(int i=0;i<k;i++) {
    if(times[i] > top) {
      top = times[i];
      topsoeji = i;
    }
  }
  cout << word[topsoeji] << " " << word[sizetopsoeji] << endl;

}