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()
{
  map<string, int> fq;
  string s, ms = "";
  while (cin >> s) {
    ++fq[s];
    if (ms.size() < s.size())
      ms = s;
  }

  int cnt = 0;
  for (map<string, int>::iterator it = fq.begin(); it != fq.end(); ++it) {
    if (cnt < (*it).second)
      s = (*it).first;
  }

  cout << s << " " << ms << endl;
  return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<vector>
#include<queue>
#include<list>
#include<stack>
#include<algorithm>
#include<cmath>
#include<memory>
#include<string>
#include<map>

using namespace std;

int main()
{
  string s;
  string mxs;
  int mxl = 0;
  map<string, int> h;
  int mxh = 0;
  string mxhs;
  
  while ( cin >> s )
    {
      if ( h.count( s ) == 0 )
        h[ s ] = 1;
      else
        ++h[ s ];
      
      if ( s.size() > mxl )
        {
          mxl = s.size();
          mxs = s;
        }
    }

  for ( auto it = h.begin(); it != h.end(); ++it )
    if ( (*it).second > mxh )
      {
        mxh = (*it).second;
        mxhs = (*it).first;
      }
  
  cout << mxhs << " " << mxs << endl;
  
  return 0;
}

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

string lowen(string str)
{
	for(int i=0; i<str.size(); i++)
	{
		if('A'<=str[i] && 'Z'>=str[i])
			str[i] += 'a'-'A';
	}
	return str;
}

int main(void)
{
	
	string str;
	int mode = 0;
	string modest = "";
	string longest = "";
	map<string,int> dic;

	while(cin >> str)
	{
		str = lowen(str);
		if(dic.count(str))
		{
			dic[str]++;
			if(mode < dic[str])
			{
				mode = dic[str];
				modest = str;
			}
		}
		else
		{
			dic.insert( map<string,int>::value_type(str,1) );
			if(longest.size() < str.size())
				longest = str;
		}
	}
	cout << modest << " " << longest << endl;
	return 0;
}

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

using namespace std;

int main(){
	string word[100];
	string most, many;
	int cut[100] = {0}, num = 0, i = 0, j, k = 0, max = 0, max1 = 0;

	while(cin >> word[i]){
		bool flag = 0;

		cut[i] ++;
		if(i == 0) num = word[i].size();
		else{
			if(word[i].size() > num){
				num = word[i].size();
				most = word[i];
			}
		}
		i++;
	}

	for(i = 0; i < num; i ++){
		k = 0;
		for(j = 0; j < num; j ++){
			if(word[i] == word[j]) k ++;
		}
		if(k > max){
			max1 = i;
			max = k;
		}
	}

	cout << word[max1] << " " << most << endl;

	return 0;
}

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

std::map<std::string,int> m;

int main()
{
	std::string s;
	std::getline( std::cin, s );
	
	int b = 0, e = 0;
	
	for( int i = 0; i < s.size(); i++ ){
		if( s[i] != ' ' ) e++;
		else{
			std::string s2 = s.substr( b, e - b );
			b = ++e;
			e = b;
			
		 	if( m.find( s2 ) != m.end() ){
				m.find( s2 )->second++;
			}
			else{
			 	m.insert( std::make_pair<std::string,int>( s2, 1 ) );
			}
		}
	}
	
	std::string s2 = s.substr( b, e - b + 1 );
	if( m.find( s2 ) != m.end() ){
		m.find( s2 )->second++;
	}
	else{
	 	m.insert( std::make_pair<std::string,int>( s2, 1 ) );
	}
	
	int len = 0, count = 0;
	for( std::map<std::string,int>::iterator it = m.begin(); it != m.end(); it++ ){
		count = std::max( count, it->second );
		len = std::max( len, (int)it->first.size() );
	}
	
	for( std::map<std::string,int>::iterator it = m.begin(); it != m.end(); it++ ){
		if( count == it->second ){
			std::cout << it->first << " ";
		}
	}
	for( std::map<std::string,int>::iterator it = m.begin(); it != m.end(); it++ ){
		if( len == it->first.size() ){
			std::cout << it->first << std::endl;
		}
	}
	
 	return 0;
}

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

class sentenceClass{
public:
    string character="";
    int numOccurrence=1;
};

int main(void){
    string maxNumSentence="";
    sentenceClass sentence[1000];
    
    int sentenceNum = 0;
    int loop = 0;
    while( cin >> sentence[sentenceNum].character )
    {
        /* Serch Max Sentence */
        if( maxNumSentence.size() < sentence[sentenceNum].character.size() )
        {
            maxNumSentence = sentence[sentenceNum].character;
        }
        
        /* Update Frequent Appearance */
        for( loop=0; loop < sentenceNum; loop++ )
        {
          if( sentence[loop].character == sentence[sentenceNum].character )
          {
            sentence[loop].numOccurrence = sentence[loop].numOccurrence + 1;
          }
        }
        sentenceNum++;   /* next sentence */
    }
    
    int maxNumOccurrence=0;
    string frequentAppearanceSentence="";
    /* Serch Max Sentence */
    for( loop=0; loop < sentenceNum; loop++ )
    {
        if( maxNumOccurrence < sentence[loop].numOccurrence )
        {
            maxNumOccurrence = sentence[loop].numOccurrence;
            frequentAppearanceSentence = sentence[loop].character;
        }
    }
    cout << frequentAppearanceSentence << " " << maxNumSentence << endl;

    return 0;
}

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

string s,mem[1000];
int i,maxnumber,number[1000],maxlong,f,maxnumberi,maxlongi;

int main(){
	while(cin>>s){
		f=0;
		i=0;
		while(mem[i].empty()!=0){
			if(mem[i]==s){
				number[i]++;
				if(maxnumber<number[i]) {
					maxnumber=number[i];
					maxnumberi=i;
				}
				f=1;
				break;
			}
			i++;
		}
		if(f!=1) {
			mem[i-1]=s;
			if(maxlong<mem[i-1].length()){
				maxlong=mem[i-1].length();
				maxlongi=i;
			}
		}

	}
	cout<<mem[maxnumberi] <<mem[maxlongi]<<endl;
	return 0;
}