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 <string.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>

#define ll (long lon
#define REP(i,n) for(int i = 0;i<(int)n;i++)
#define FOR(i,a,b) for(int i = (a);i < (b);i++)
#define RFOR(i,a,b) for(int i = (a);i>(b);i--)
#define INT_MIN_A -999999

using namespace std;

int main (void){
    
    char str[2001];
    gets(str);
    char tango[1000][33];
    int i = 0,j = 0,k = 0,l = 0, temp = 0,m = 0;
    int max_l = INT_MIN_A;
    int max_numer = 0;
    int yokuderu = 0;
    int yokuderu_temp = 0;
    int yokuderu_number = 0;
    while(str[i++] != '\0')
    {
        if(str[i-1] == ' ')
        {
            if((i-1)-temp>max_l)
            {
                max_l = (i-1) -temp;
                max_numer = j;
            }
            while(temp<i-1)
                tango[j][l++] = str[temp++];
            temp = i;
            j++;
            l = 0;
        }
    }
    
 
        if((i-1)-temp>max_l)
        {
            max_l = (i-1) -temp;
            max_numer = j;
        }
        while(temp<i-1)
            tango[j][l++] = str[temp++];
        temp = i;
        j++;
        l = 0;
    /*???????????§??????????????????*/
    //cout <<"number is " << j << endl;
    
    for(int m = 0; m < j;m++)
    {
        for(int k = 0; k<j;k++)
        {
            if(m != k)
            {
                if(strcmp(tango[m], tango[k]) == 0)
                {
                    yokuderu_temp++;
                }
            }
        }
        if(yokuderu_temp >= yokuderu)
        {
            yokuderu = yokuderu_temp;
            yokuderu_number = m;
        }
        yokuderu_temp = 0;
    }
    REP(i,32)
    cout << tango[yokuderu_number][i]; cout <<" ";
    REP(j,32)
    cout << tango[max_numer][j];
    cout << endl;
    
    
    return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>

using namespace std;

int main()
{
	int longlen = 0;
	string str, longstr;
	vector<pair<int, string> > vc;

	while (cin >> str)
	{
		if((int)strlen(str.c_str()) > longlen){
			longlen = strlen(str.c_str());
			longstr = str;
		}
		
		bool bl = true;
		vector<pair<int, string> >::iterator it = vc.begin();
		while(it != vc.end())
		{
			if(it->second == str){
				it->first--;
				bl = false;
			}
			it++;
		}

		if(bl){
			vc.push_back(make_pair(0, str));
		}
	}
	
	sort(vc.begin(), vc.end());

	cout << vc[0].second << " " << longstr << endl;

	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
int main(){
	char ans[50][10000] = {{0}};
	char a[10000] = {0};
	scanf("%[^\n]",a);
	int cnt = 0;
	int mx_len = 0;
	char date[10000] = {0};
	a[strlen(a)] = ' ';
	for(int i = 0,j = 0; i <= strlen(a); i++){
        if(a[i] >= 'a' && a[i] <= 'z' || a[i] >= 'A' && a[i] <= 'Z'){
            ans[cnt][j] = a[i];
            j++;
        }
        else{
            if(mx_len < j){
                strncpy(date,a+i-j,j);
                mx_len = max(mx_len,j);
            }
            cnt++;
            j = 0;
        }
	}
	int check[10000] = {0};
	for(int i = 0; i < cnt; i++){
        for(int j = i; j < cnt; j++){
            if(i != j){
                if(strcmp(ans[i],ans[j]) == 0){
                    fill(ans[j],ans[j]+1000,0);
                    check[i]++;
                }
            }
        }
	}
	mx_len = 0;
	char mx_date[10000] = {0};
	for(int i = 0; i < cnt; i++){
	    if(mx_len < check[i]){
	        strcpy(mx_date,ans[i]);
            mx_len = max(mx_len,check[i]);
	    }
	}
    cout << mx_date << " "<< date << endl;
	return 0;
}

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

int main(){
	string str;
	string word[1000];
	int rate[1000], kind = 0;
	int M_leng = 0, mode;
	string res_mod, res_len;
	bool new_word;
	
	for(int i = 0; i < 1000; i++) rate[i] = 0;
	while((cin >> str)){
		new_word = true;
		for(int i = 0; i < kind; i++){
			if(str == word[i]){
				new_word = false;
				rate[i]++;
				break;
			}
		}
		
		if(new_word){
			word[kind] = str;
			rate[kind]++;
			kind++;
		}
	}
	
	mode = 0;
	for(int i = 0; i < kind; i++){
		if(mode < rate[i]){
			res_mod = word[i];
			mode = rate[i];
		}
		if(M_leng < word[i].size()){
			res_len = word[i];
			M_leng = word[i].size();
		}
	}
	
	cout << res_mod << " " << res_len << endl;
	
	return 0;
}

C++: #include<iostream>
#include<string>
#include<map>
using namespace std;int main(){map<string,int>m;string s,t,u;for(;cin>>s;s.length()>u.length()?u=s:u)++m[s]>m[t]?t=s:s;cout<<t<<" "<<u<<endl;}

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

#define SAFE_DELETE( x ){ if ( x ){ delete x; x = NULL; } }

struct tCell{
	tCell() : count( 0 ), prev( NULL ), next( NULL ){}

	int count;
	string s;
	tCell *prev, *next;
};

class Database{
public:
	Database() : size( 0 ), head( NULL ), tail( NULL ){
		head = new tCell;
		tail = new tCell;
		head->next = tail;
		tail->prev = head;
	}
	~Database(){
		init();
		SAFE_DELETE( tail );
		SAFE_DELETE( head );
	}

	void init(){
		for ( int i = size; i > 0; --i ){
			--size;
			tCell* cell = tail->prev;
			cell->prev->next = cell->next;
			cell->next->prev = cell->prev;
			SAFE_DELETE( cell );
		}
	}
	void store( string& s ){
		bool stored = false;
		tCell* cell = head;
		for ( int i = 0; i < size; ++i ){
			cell = cell->next;
			if ( cell->s == s ){
				++cell->count;
				stored = true;
				break;
			}
		}
		if ( !stored ){
			pushBack( s );
		}
	}
	string getMaxCount(){
		if ( !size ) return "";
		int c = 0;
		tCell* cell = head;
		tCell* maxc = NULL;
		for ( int i = 0; i < size; ++i ){
			cell = cell->next;
			if ( c < cell->count ){
				c = cell->count;
				maxc = cell;
			}
		}
		return maxc->s;
	}
	string getMaxCharSize(){
		if ( !size ) return "";
		unsigned c = 0;
		tCell* cell = head;
		tCell* maxc = NULL;
		for ( int i = 0; i < size; ++i ){
			cell = cell->next;
			if ( c < cell->s.size() ){
				c = cell->s.size();
				maxc = cell;
			}
		}
		return maxc->s;
	}

private:
	void pushBack( string& s ){
		++size;
		tCell* cell = new tCell;
		cell->s = s;
		++cell->count;
		cell->prev = tail->prev;
		cell->next = tail;
		cell->prev->next = cell;
		cell->next->prev = cell;
	}

	int size;
	tCell *head, *tail;
};

int main(){
	string s;
	Database db;

	getline( cin, s );

	istringstream iss( s );
	while ( !iss.eof() ){
		iss >> s;
		db.store( s );
	}

	cout << db.getMaxCount() << " " << db.getMaxCharSize() << endl;

	return 0;
}

C++: #include<iostream>
#include<cstring>
using namespace std;
struct word{
	int len;
	int num;
	char w[32];
};
int main(){
	word vo[1000];
	char vol[32];
	int k = 0,max[2]={0,0};
	while(cin>>vol){
		int i;
		for(i=0; i<k; i++){
			if(strcmp(vo[i].w,vol) == 0){
				vo[i].num++;
				break;
			}
		}
		if(i == k){
			i++;
			strcpy(vo[i].w,vol);
			vo[i].num = 1;
			vo[i].len = strlen(vo[i].w);
		}
	}
	for(int i=1; i<k; i++){
		if(vo[max[0]].len<vo[i].len){max[0] = i;}
		if(vo[max[1]].num<vo[i].num){max[1] = i;}
	}
	cout <<vo[max[1]].w<<" "<<vo[max[0]].w<<endl;
	return 0;
}