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(void) {
  string mcs;
  int maxlength;
  string mls;
  map<string, int> index;
  string s;
  int flag;
  flag = 0;
  maxlength = -1;
  while(cin >> s) {
    index[s]++;
    if((int)s.length() > maxlength) {
      maxlength = s.length();
      mls = s;
    }
    if(flag) {
      if(index[s] > index[mcs]) {
	mcs = s;
      }
    }else {
      mcs = s;
      flag = 1;
    }
  }
  cout << mcs << " " << mls << endl;

  return 0;
}

C++: #include<stdio.h>
#include <string.h>
int main(){
	int i,n=0,q=0,c[500],a=0,b=0;
	char s[1000],t[500][32],*p;
	fgets(s,1024,stdin);
	while(1){
		p=strchr(s+q,' ');
		if(!p)
			p=s+strlen(s)-1;
		strncpy(t[n],s+q,p-s-q);
		for(i=0;i<n;i++)
			if(strcmp(t[i],t[n])==0){
				c[i]++;
				break;
			}
			if(i==n){ 
				c[i]=1;
				n++; 
			}
			q=p-s+1;
			if(p==s+strlen(s)-1) 
				break;
	}  
	for(i=1;i<n;i++){
		if(c[i]>c[a])  
			a=i; 
		if(strlen(t[i])>strlen(t[b]))    
			b=i; 
	} 
	printf("%s %s\n",t[a],t[b]); 
	return 0;
}

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

int main(void){
  map<string,int>m;
  map<string,int>::iterator it,cit,sit;
  string s;
  int maxS=0,maxC=0;
  while(cin >>s){
    m[s]+=1;
  }
  for(it=m.begin();it!=m.end();it++){
    int size=(*it).first.size();
    if(size>maxS){
      sit=it;
      maxS=size;
    }
    int cou=(*it).second;
    if(cou>maxC){
      cit=it;
      maxC=cou;
    }
  }

  /*
 for(it=m.begin();it!=m.end();it++){
   cout <<(*it).first.size() <<" "<<(*it).second<<endl;
  }
  */
  cout <<(*cit).first <<" "<<(*sit).first<<endl;
}

C++: #include<iostream>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<functional>
using namespace std;
int main() {
	vector<pair<int,string>> x(1000);
	string a;
	int j=1,s=0,m=0;
	while(cin >> a) {
		for (int i = 0; i <j ; i++) {
			if (x[i].second == a) {
				x[i].first++;
				break;
			}
			if (i == j - 1) {
				x[i].second = a;
				x[i].first = 1;
				j++;
				break;
			}
		}
	}
	sort(x.begin(), x.end(), greater<pair<int, string>>());
	for (int i = 0; i < j; i++) {
		if (x[i].second.size() > s) {
			s = x[i].second.size();
		}
	}
	for (int i = 0; i < j; i++) {
		if (x[i].first > m) {
			m = x[i].first;
		}
	}
	for (int i = 0; i < j; i++) {
		if (x[i].first == m) {
			cout << x[i].second << ' ';
		}
	}
	for (int i = 0; i < j; i++) {
		if (x[i].second.size() == s) {
			cout << x[i].second << endl;
		}
	}
	return 0;
}

C++: //
//  main.cpp
//  kazane
//
//  Created by h3036136 on 2017/07/27.
//  Copyright ?? 2017??´ h3036136. All rights reserved.
#include <iostream>
#include <string>
using namespace std;
int main(){
    long saidai=0;
    //char f;
    int a=0,cnt=0,num=0,max=0;
    string str,tango[1000]={""},answer,ans;
    getline(cin,str);
    for(int i=0;i<str.size();i++){
        if(str[i]==' '){
            for(int j=a;j<i;j++){
                /*if(isupper(str[j])){
                    f=str[j];
                    f=f+32;
                    str[j]=f;
                }*/
                tango[cnt]+=str[j];
            }
            cnt=cnt+1;
            a=i+1;
        }
    }
    for(int p=a;p<str.size();p++){
        tango[cnt]+=str[p];
    }
    
    for(int k=0;k<1000;k++){
        if((tango[k]==""))break;
        if(saidai<tango[k].size()){
            saidai=tango[k].size();
            ans=tango[k];
        }
    }
    
    for(int s=0;s<=cnt;s++){
        for(int t=s+1;t<=cnt;t++){
            if(tango[s]==tango[t]){
                num=num+1;
            }
        }
        if(max<num){
            max=num;
            answer=tango[s];
        }
    }
    cout<<max<<" "<<saidai<<endl;
    cout<<answer<<" "<<ans<<endl;
    return 0;
}

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

int main(){
  int m=0,f=0;
  multiset<string> a;
  string s,ms,mf;
  while(cin>>s){
    if(m<s.size())ms=s;m=s.size();
    if(f<a.count(s)+1)mf=s;f=a.count(s)+1;a.insert(s);
  }
  cout<<mf<<" "<<ms<<endl;
  return 0;
}

C++: #include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
	string str,s,mls,mcs,input[31];
	map <string,int> dic;
	int n,c,a,ml,mc;
	while(getline(cin,str)){
		c = a = mc = ml = 0;
		str += ' ';
		while(str.length()){
			n = str.find(' ');
			s = str[c];
			++c;
			for(;c < n;++c){
				s += str[c];
			}
			str.erase(0,n+1);
			c = 0;
			input[a] = s;
			++a;
			++dic[s];
			if(s.length() > ml) {
				ml = s.length();
				mls = s;
			}
		}
		for(int i = 0;i < a;++i){
			if(mc < dic[input[i]]){
				mc = dic[input[i]];
				mcs = input[i];
			}
		}
		cout << mcs << " " << mls << endl;
	}
	return 0;
}

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

int main(void){
	map<string, int> word;
	string instr, mfstr, maxl = "";
	int noo = 0;
	
	while(cin >> instr){
		if(word.find(instr) != word.end()){
			word[instr]++;
		}
		else{
			word.insert(pair<string, int>(instr, 1));
		}

		if(instr.size() > maxl.size())	maxl = instr;
	}

	map<string, int>::iterator p;
	for(p = word.begin(); p != word.end(); p++){
		if(noo < p->second){
			noo = p->second;
			mfstr = p->first;
		}
	}

	cout << mfstr << " " << maxl << endl;
  return 0;
}

C++: #include<iostream>
#include<string.h>

using namespace std;

int main(void)
{
	char word[1000][32];
	char tmp[32];
	int length[1000];
	int freq[1000]={0};
	int maxlen=0;
	int maxfreq=0;
	int wordnum=0;
	while(cin>>tmp)
	{
		int i;
		for(i=0;i<wordnum;i++)
		{
			if(strcmp(word[i],tmp)==0)
			{
				break;
			}
		}
		strcpy(word[i],tmp);
		wordnum++;
		freq[i]++;
		length[i]=0;
		for(int j=0;word[i][j]!='\0';j++)
		{
			length[i]++;
		}
		if(freq[maxfreq]<freq[i])
		{
			maxfreq=i;
		}
		if(length[maxlen]<length[i])
		{
			maxlen=i;
		}
	}
	cout<<word[maxfreq]<<" "<<word[maxlen]<<endl;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
    long saidai=0;
    char f;
    int a=0,cnt=0,num=0,max=0;
    string str,tango[1000]={""},answer,ans;
    getline(cin,str);
    for(int i=0;i<str.size();i++){
        if(str[i]==' '){
            for(int j=a;j<i;j++){
                if(j==0){
                    f=str[j];
                    f=f+32;
                    str[j]=f;
                }
                tango[cnt]+=str[j];
            }
            cnt=cnt+1;
            a=i+1;
        }
    }
    for(int p=a;p<str.size();p++){
        tango[cnt]+=str[p];
    }
    
    for(int k=0;k<1000;k++){
        if((tango[k]==""))break;
        if(saidai<tango[k].size()){
            saidai=tango[k].size();
            ans=tango[k];
        }
    }
    
    for(int s=0;s<=cnt;s++){
        for(int t=s+1;t<=cnt;t++){
            if(tango[s]==tango[t]){
                num=num+1;
            }
        }
        if(max<num){
            max=num;
            answer=tango[s];
        }
    }
    cout<<answer<<" "<<ans<<endl;
    return 0;
}