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<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1e9 + 7;
const long long INF = 1LL << 60;

int main() 
{
    string s;
    pair<string,int> p;
    vector<string> v;
    vector<string> u;
    while(cin >> s){
        v.push_back(s);
        bool e = true;
        for(int i = 0; i < u.size(); i++){
            if(u[i] == s){
                e = false;
            }
        }
        if(e) u.push_back(s);
    }
    int n = u.size();

    int cnt[n];
    for(int i = 0; i < n; i++){
        cnt[i] = 0;
    }
    int l = 0;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < v.size(); j++){
            if(u[i] == v[j]){
                cnt[i]++;
            }
            int m = v[j].size();
            l = max(l,m);
        }
    }
    int k = 0;
    for(int i = 0; i < n; i++){
        k = max(k,cnt[i]);
    }
    for(int i = 0; i < n; i++){
        if(cnt[i] == k){
            cout << u[i] << ' ';
        }
    }
    for(int i = 0; i < n; i++){
        if(u[i].size() == l){
            cout << u[i] << endl;
        }
    }
}

C++: #include<iostream>
#include<string>
using namespace std;
string a,b[1000],d;
int c[1000];
int main(){
	int top=0;
	d=" ";
	while(cin>>a){
		if(a.size()>=d.size())
			d=a;
		bool t=true;
		for(int i=0;i<top;i++){
			if(b[i]==a){
				t=false;
				c[i]++;
			}
		}
		if(t==true){
			b[top]=a;
			c[top]=1;
			top++;
		}
	}
	int best=0,set;
	for(int i=0;i<top;i++){
		if(c[i]>best)
			set=i;
	}
	cout<<b[set]<<" "<<d<<endl;
	return 0;
}

C++: #include<iostream>

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 <iostream>
#include <string>
#include <map>
#include <stdio.h>
using namespace std;

int main() {
	string sp,st,hw,ew;
	map<string,int> sd;
	int s=0,e=0,k=0,h=0,m=0;
    getline(cin,st);
	st=st+"  ";
	while(e!=st.size()) {
	 for(e; st[e]!=' ' ;e++);
	 sp.append(st,s,e-s);
	 if (sp.length()>h) { h=sp.length(); hw=sp; }
	 if (sd.find(sp)==sd.end()) sd.insert(map<string,int>::value_type(sp,1));
	 else {sd[sp]++ ; if (sd[sp]>m) m=sd[sp]; }
	 e++; s=e; sp=""; 
	}
	map<string,int>::iterator it=sd.begin();
	for (h=0;it!=sd.end();it++) if (h<(*it).second) { h=(*it).second; ew=(*it).first;}
	cout << ew << " " << hw << endl;
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <math.h>
#include <functional>
#include <algorithm>
#include <utility>

typedef long long Int;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
using namespace std;


map<string, int> aa;
set<string> dic;

int main(){
	string a;

	while (cin >> a){
		dic.insert(a);
		++aa[a];
	}

	int m = 0;
	string ms;

	int m2 = 0;
	string ms2;


	for (auto x : dic){
		if (m < x.length()){
			m = x.length();
			ms = x;
		}
	}

	for (auto x : aa){
		if (m2 < x.second){
			ms2 = x.first;
			m2 = x.second;
		}
	}

	cout << ms << " " << ms2 << endl;

	return 0;
}

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

int main(){
  map< string, int > m;
  string tmp;
  string max_len = "";

  while(cin >> tmp){
    m[tmp] += 1;
    if(max_len.length() < tmp.length()) max_len = tmp;
  }

  map< string, int >::iterator it, it_max_fre = m.begin();
  for(it = m.begin(); it != m.end(); it++){
    if(it_max_fre->second < it->second) it_max_fre = it;
  }

  cout << it_max_fre->first << " " << max_len << endl;
}

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;
    }
    cout << tango[yokuderu_number] << " " << tango[max_numer] << endl;
    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<map>
using namespace std;
int main(){
  map<string,int> t;
  string s, mxc, mxl;
  int freq = 0, len = 0;
  while(cin >> s){
    if(t.find(s) == t.end()){
      t[s] = 1;
    }
    else{
      t[s]++;
    }

    if(t[s] > freq){
      freq = t[s];
      mxc = s;
    }
    if(s.size() > len){
      len = s.size();
      mxl = s;
    }
  }
  cout << mxc << " " << mxl << endl;
}

C++: #include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(){
    int n=0,i,cnt[100]={0},j=0,max=0,longer=0,cou[100]={0};
    char str,save[100][100];
    while(1){
        scanf("%c",&str);
        if(str=='\n') break;
        if(str!=' '){
            if(isupper(str)) {
                str = tolower(str);
            }
            save[j][n]=str;
            n++;
            cou[j]++;
        }else{
            for(i=0;i<j;i++){
                if(!strcmp(save[i],save[j])){
                    cnt[i]++;
                }
            }
            j++;
            n = 0;
        }
    }
    for(i=0;i<=j;i++){
        if(cnt[max]<=cnt[i]) max=i;
    }
    for(i=1;i<=j+1;i++){
        if(cou[longer]<=cou[i]){
            longer=i;
        }
    }
    printf("%s %s\n",save[max],save[longer]);

    return 0;
}