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

int main() {

  string s;
  map<string, int> names;

  while(cin>>s) {
    if(s=="") break;
    if( names.find(s) == names.end() ) {
      names.insert( map<string, int>::value_type(s,1) );
    }else{
      names[s]++;
    }
  }

  //cout<<"AA"<<endl;
  map<string, int>::iterator it = names.begin();
  int max=0,ml=0;
  string lo,fr;
  while( it != names.end() ) {
    //cout<<(*it).first<<" "<<(*it).second<<endl;
    if( (*it).second > max ) {
      max = (*it).second;
      fr = (*it).first;
    }
    if( (*it).first.length() > ml ) {
      ml = (*it).first.length();
      lo = (*it).first;
    }
    it++;
  }

  cout<<fr<<" "<<lo<<endl;
}

C++: #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define pb         push_back
#define mp         make_pair
#define ll         long long
#define PI         acos(-1.0)
#define ALL(A)     ((A).begin(), (A).end())
#define vsort(v)   sort(v.begin(),v.end())
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)


int main(){
    int i, j, lmax=0, lind=0, nmax=0, nind=0, cnt=0, vsize;
    string s,vv;
    vector<string> v;
    while(cin>>s){
        v.pb(s);
    }
    cout << int(v.size()) << endl;
    for(i=0;i<int(v.size());i++){
        cnt=0;
        vv=v[i];
        for(j=0;j<int(vv.size());j++){
            if(v[i]==v[j]){
                cnt++;
            }
        }
        if(nmax<cnt){
            nmax=max(cnt,nmax);
            nind=i;
        }
        if(lmax<vv.size()){

            lmax=max(lmax,int(vv.size()));
            lind=i;
        }
    }
    cout << v[lind] << v[nind] << endl;
}

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

using namespace std;

/** Problem0029 : English Sentence **/
int main()
{
	map<string, int> sentences;
	pair<string, int> t;
	string tmp, maxLength;
	
	while (cin >> tmp) {
		if (tmp.length() > maxLength.length())
			maxLength = tmp;
		
		if (sentences.count(tmp) == 0) {
			sentences.insert(map<string,int>::value_type(tmp, 1));
		} else {
			sentences[tmp]++;
		}
	}
	
	t = *max_element(sentences.begin(), sentences.end());
	cout << t.first << " " << maxLength << endl;
	
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

int main(){
	string word, lword, rword;
	cin >> word;
	lword = word;
	rword = word;
	int count = 0;
	map<string, int> data;
	data[rword] = 1;

	while(cin >> word){
		if(lword.size() < word.size()) lword = word;
		data[word]++;
		if(data[word] > count){
			rword = word;
			count = data[word];
		}
	}
	cout << rword << " " << lword << endl;
	

}

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

int main(){
  map<string,int> words;
  int l_max=0, f_max=0;
  string longest, frequent;

  string word;
  while(cin >> word){
    words[word]++;
    if(word.size()>l_max){
      l_max=word.size();
      longest=word;
    }
    if(words[word]>f_max){
      f_max=words[word];
      frequent=word;
    }
  }
  cout << frequent << ' ' << longest << endl;

  return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main(){
	map<string , int> data;
	string mxlen,mst,str;

	while(cin >> str){
		data[str]++;
		if(data[str] > data[mst]){
			mst = str;
		}
		if(str.size() > mxlen.size()){
			mxlen = str;
		}
	}
	cout << mst << ' ' << mxlen << endl;
	return 0;
}

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

int main(){
	string s, str1, str2;
	int maxn = 0, maxl = 0;
	map<string, int> mp;
	while(cin >> s){
		
		
		//if(s == "0")break;
		
		
		for(int i = 0;i < s.size();i++){
			if(s[i]>='A' && s[i]<='Z')s[i] += 'a'-'A';
		}
		mp[s]++;
		if(mp[s] > maxn){maxn = mp[s];str1 = s;}
		int size = s.size();
		if(size > maxl){maxl = size;str2 = s;}
		cout << s << " ";
	}
	
	//cout << mp["have"];
	cout << str1 << " " << str2 << endl;
	return 0; 
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdint>

typedef std::map<std::string, std::uint32_t> OccurenceWordMap;

class compare_second {
		typedef OccurenceWordMap::value_type value_type;
	public:
		bool operator()(value_type const& lhs, value_type const& rhs) const
		{
			return lhs.second < rhs.second;
		}
};

class compare_length {
		typedef std::string value_type;
	public:
		bool operator()(value_type const& lhs, value_type const& rhs) const
		{
			return lhs.length() < rhs.length();
		}
};

int main()
{
	std::string input_text;
	std::getline(std::cin, input_text);
	typedef std::vector<std::string> StringVec;
	StringVec word_vec;
	std::string::size_type pos1 = 0;
	std::string::size_type pos2;
	while ((pos2 = input_text.find(' ', pos1)) != std::string::npos) {
		word_vec.push_back(input_text.substr(pos1, pos2 - pos1));
		pos1 = pos2 + 1;
	}
	word_vec.push_back(input_text.substr(pos1, input_text.size() - pos1));
	OccurenceWordMap ow_map;
	for (std::string const& word : word_vec) {
		auto i = ow_map.lower_bound(word);
		if (i != ow_map.end() && !(ow_map.key_comp()(word, i->first))) {
			++i->second;
		}
		else {
			ow_map.emplace(word, 0);
		}
	}
	std::cout << std::max_element(ow_map.begin(), ow_map.end(), compare_second())->first << ' '
			  << *std::max_element(word_vec.begin(), word_vec.end(),  compare_length()) << std::endl;
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
	string str, longest, s, most;
	int m=0, count=0;
	vector<string> vs;
	vector<int>vi;
	getline(cin, str);
	for(int i=0; i<str.length(); i++){
		if(str[i]!=' ' && str[i]!='\n'){
			s+=str[i];
		}
		else{
			vs.push_back(s);
			if(s.length()>m){
				m=s.length();
				longest=s;
			}
			s="";
		}
	}
	if(s.length()>m){
		m=s.length();
		longest=s;
	}
	m=0;
	for(int i=0; i<vs.size()-1; i++){
		count=0;
		for(int j=i+1; j<vs.size(); j++){
			if(vs[i]==vs[j])
				count++;
		}
		if(count>m){
			m=count;
			most=vs[i];
		}
	}
	cout<<most<<" "<<longest<<endl;
	return 0;
}

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

int main(void){
  string s;
  getline(cin,s);
  string n;
  string maxs;
  string longs ="";
  int maxv;
  vector<string> ss;
  vector<int> ii;
  s += " ";
  for(int i = 0 ; i < s.size() ; i ++){
    if(s[i] == ' '){
      if(!ss.size()){
	maxv = 0;
	maxs = n;
      }
      if(longs.size() < n.size()){
	longs = n;
	//cout<<n<<endl;
      }
      bool used = false;
      for(int i = 0 ; i < ss.size() ; i ++){
	if(n == ss[i]){
	  ii[i] ++;
	  if(maxv < ii[i]){
	    maxv = ii[i];
	    maxs = n;
	  }
	  used = true;
	  break;
	}
      }
      if(!used){
	ii.push_back(1);
	ss.push_back(n);
      }
      n = "";
    }else{
      n += s[i];
    }
  }
  cout<<maxs<<" "<<longs<<endl;
}