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 <string>
#include <map>

using namespace std;

int main(){
  int max = 0;
  string str,maxs;
  map<string,int> M;
  while( cin >> str ){
    if(max < (int)str.size()){
      max = str.size();
      maxs = str;
    }
    M[str]++;
  }
  string fs;
  int m = 0;
  for( map<string,int>::iterator it = M.begin(); it != M.end(); it++ ){
    if(m < (*it).second){
      m = (*it).second;
      fs = (*it).first;
    }
  }
  cout << fs << " " << maxs << endl;
}

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

int main() {
	typedef int Freqency;
	typedef string Name;
	map<Name, Freqency> table;
	string name, freqMax = "", lenMax = "";

	while (cin >> name) {
		table[name]++;
		if (table[name] > table[freqMax]) freqMax = name;

		if (name.size() > lenMax.size()) lenMax = name;
	}

	cout << freqMax << " " << lenMax << endl;
}

C++: #include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <sstream>
#include <utility>
#include <cstdlib>
#include <cctype>
#include <climits>
#include <fstream>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef vector<pair<int, int> > vpii;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second
using namespace std;

map <string,int> ans;
int l=0;
int k=0;

int main(){
    string str;
    string a,b;
    while(cin>>str){
        if(str.size()>=l){
            b = str;
            l=str.size();
        }
        ans(str)++;
        if(ans(str)>=k){
            k=ans(str);
            a=ans;
        }
    }
    cout<<a<<" "<<b<<endl;
}

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

int main()
{
	char get[1000][40] ;
	char mode[40] ;
	char longest[40] ;

	int count = 0 ;
	int lest = -1 ;
	
	int tmp = 0 ;

	int most = 0 ;
	int mnum = -1 ;

	int i = 0 ;

	while( cin >> get[i] )
	{
		if( count < strlen(get[i]) )
		{
			count = strlen(get[i]) ;
			lest = i ;
		}

		for( int j = (i-1) ; j >= 0 ;  j -- )
		{
			if( strcmp( get[i], get[j] ) == 0 )
			{
				tmp ++ ;
			}
		}
		tmp = 0 ;

		if( most < tmp )
		{
			most = tmp ;
			mnum = i ;
		}

		i ++ ;
	}

	cout << get[mnum] << " " << get[lest] ;

	return 0 ;
}

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

int main(){
  std::string str;
  std::string maxlen;
  std::string maxocc;
  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 <iostream>
#include <cstring>
using namespace std;

int main(){
	char str[1000];
	char word[33][33]={0};
	int longest=0;
	int check[33]={0};
	char *tmp;
	int freq=0;
	int count=0;
	int i,j;
	size_t len , prev;
	fgets(str , sizeof(str) , stdin);
		tmp=str;
		for(i=0 ; str[i]!='\0' ;i++){
			if(str[i]==' '){
				str[i]='\0';
				strcpy((char*)&word[count] , (const char*)tmp);
				tmp=str+i+1;
				count++;
			}
		}
		strcpy((char*)&word[count],(const char*)tmp);
		count++;
	for(i=0 ; i<count ; i++){
		for(j=i ; j<count ; j++){
			if(strcmp((const char*)&word[i] , (const char*)&word[j])==0){
				check[i]++;
			}
		}
	}
	for(i=count; i>=0 ; i--){
		for(j=0 ; j<i-1 ; j++){
			if(check[j]>check[j+1]){
				check[j]^=check[j+1];
				check[j+1]^=check[j];
				check[j]^=check[j+1];
				freq=j;
			}
		}
	}
		prev=strlen(word[0]);
	for (i=0 ; i<count ; i++){
		len=strlen(word[i]);
		if(len > prev){
			prev = len;
			longest=i;
		}	
	}
	
	cout << (char*)&(word[freq]) << " "<< (char*)&(word[longest]) << endl;
	return 0;
}

C++: /*
	0029:English sentence
*/
#include	<iostream>
#include	<string>
#include	<map>

using namespace std;

typedef map<string, int> M_SI;

int main(void) {
	int maxlen = 0, maxcou = 0; 
	string buf_str, maxlenSen, maxcouSen;
	M_SI Sentence;
	
	while(1) {
		cin >> buf_str;
		if(cin.eof()) { break; }
		if(Sentence.empty() || Sentence.count(buf_str) == 0) {
			Sentence.insert( M_SI::value_type(buf_str, 1) );
		} else {
			M_SI::iterator it = Sentence.find(buf_str);
			(*it).second++;
		}
	}
	M_SI::iterator it = Sentence.begin();
	while(it != Sentence.end()) {
		string bff = (*it).first;
		int bfs = (*it).second, bfl = bff.size();
		
		if(maxlen < bfl) {
			maxlenSen = bff;
			maxlen = bfl;
		}
		if(maxcou < bfs) {
			maxcouSen = bff;
			maxcou = bfs;
		}
		it++;
	}
	cout << maxcouSen << ' ' << maxlenSen << endl;
	
	return 0;
}

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

int main(){

	int max=0;
	string a;
	map<string,int> s;
	string x,y;
	
	cin>>a;
	s[a]++;
	x=y=a;
	
	while(cin>>a){
		s[a]++;
		if(y.size()<a.size())
			y=a;
		if(s[a]>max){
			max=s[a];
			x=a;
		}
	}
	
		cout<<x<<" "<<y<<endl;
}

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

int main(void){
  vector<string> str;
  vector<int> cnt;
  string buf, maxstr;
  int max = 0, ans, i;

  while(cin >> buf){
    bool f = true;

    if(max < buf.length()){
      max = buf.length();
      maxstr = buf;
    }
    for(i = 0; i < str.size(); i++){
      if(str[i] == buf){
	f = false;
	break;
      }
    }
    if(f){
      str.push_back(buf);
      cnt.push_back(1);
    }
    else{
      cnt[i]++;
    }
  }

  max = 0;
  for(i = 0; i < cnt.size(); i++){
    if(cnt[i] > max){
      max = cnt[i];
      ans = i;
    }
  }

  cout << str[ans] << ' ' << maxstr << endl;

  return 0;
}

C++: #include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
    map<string,int>m;
    string s;
    vector<string>v;
    while(cin>>s){
        if('A'<=s[0]&&s[0]<='Z'){
            s[0]=s[0]-'A'+'a';
        }
        m[s]++;
        v.push_back(s);
    }
    int ans1=-1;
    int ans2=-1;
    string ans1s;
    string ans2s;
    for(int i=0;i<v.size();i++){
        if(ans1<m[v[i]]){
            ans1=m[v[i]];
            ans1s=v[i];
        }
        if(ans2<v[i].size()){
            ans2=v[i].size();
            ans2s=v[i];
        }
    }
    cout<<ans1s<<" "<<ans2s<<endl;
}