Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	l := sc.Text()
	words := strings.Split(l, " ")

	frequency := map[string]int{}
	long := map[string]int{}
	var maxFrequency, longest int
	var frequentWord, longestWord string
	for _, w := range words {
		frequency[w]++
		long[w] = len(w)
		if frequency[w] > maxFrequency {
			maxFrequency = frequency[w]
			frequentWord = w
		}
		if len(w) > longest {
			longest = long[w]
			longestWord = w
		}
	}

	fmt.Println(frequentWord + " " + longestWord)
}

C++: #include<cstdio>
#include<cstring>

int main(){
	char word[380][33];
	int count[380] = {};
	int now = 0;
	int max = 0;
	int a, b = 0;
	char s[33];
	while(scanf("%s", &s) + 1){
		int t = 0;
		while(s[t]){
			if('A' <= s[t] && s[t] <= 'Z'){
				s[t] = s[t] + 'a' - 'A';
			}
			t++;
		}
		bool flug = true;
		for(int i = 0; i < now; i++){
			if(strstr(word[i], s)){
				count[i]++;
				if(count[i] > max){
					max = count[i];
					a = i;
				}
				flug = false;
				break;
			}
		}
		if(flug){
			strcpy(word[now], s);
			if(strlen(word[b]) < strlen(s)){
				b = now;
			}
			now++;
		}
	}
	printf("%s %s\n", word[a], word[b]);
	return 0;
}

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

int main()
{
	char get[1000][40] ;
	char mode[40] ;
	char longest[40] ;

	int count = 0 ;
	int lest = -1 ;
	
	int tmp = 0 ;

	int most = 0 ;
	int mnum = -1 ;

	int i = 0 ;

	while( cin >> get[i] )
	{
		if( count < strlen(get[i]) )
		{
			count = strlen(get[i]) ;
			lest = i ;
		}

		for( int j = (i-1) ; j >= 0 ;  j -- )
		{
			if( strcmp( get[i], get[j] ) == 0 )
			{
				tmp ++ ;
			}
		}
		tmp = 0 ;

		if( most < tmp )
		{
			most = tmp ;
			mnum = i ;
		}

		i ++ ;
	}

	cout << get[mnum] << " " << get[lest] ;

	return 0 ;
}

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

int main(){
    map<string, int> word;
    string s;
    string outen;
    string outlen;
    int maxen;
    int maxlen;
    maxen = 0;
    maxlen = 0;
    while(cin >> s){
        if(word.find(s) != word.end()){
            word[s]++;
            if(word[s] > maxen){
                outen = s;
            }
        }else{
            word.insert(map<string, int>::value_type(s, 1));
            if(s.size() > maxlen){
                outlen = s;
            }
            if(word[s] > maxen){
                outen = s;
            }
        }
    }
    cout << outen << " " << outlen << endl;
    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<cassert>
using namespace std;
int inf = 1000000000;

int main(void) {

  string s;
  getline(cin, s);
  s += ' ';
  string tmp = "";
  string maxword = "";
  vector< pair<string, int> > p;
  for(int i=0; i<s.size(); i++){
    if( s[i] != ' ' ) tmp += s[i];
    else{
      if( maxword.size() < tmp.size() ) maxword = tmp;
      bool f = false;
      for(int j=0; j<p.size(); j++){
        if( p[j].first == tmp ){
          f = true;
          p[j].second++;
        }
      }
      if( !f ) p.push_back( make_pair(tmp, 1) );
      tmp = "";
    }
  }
  int mx = 0;
  string med;
  for(int i=0; i<p.size(); i++){
    if( mx < p[i].second ){
      mx = p[i].second;
      med = p[i].first;
    }
  }
  cout << med << " " << maxword << endl;

  return 0;
}


// EOF

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

using namespace std;

int main(){
  string s;
  string max;
  int maxsize  = 0;
  map <string, int> m;
  while(cin >> s)
  	m[s]++;
   if(s.size() > maxsize){
       max = s;
       maxsize = s.size();
   }

   map<string,int>::iterator it = m.begin();
   string freq;
   int maxfreq = 0;
   for(it; it != m.end();it++){
   	 int k = (*it).second;
   	  if(k > maxfreq ){
   	  	maxfreq = k;
   	  	freq = (*it).first;
   	  }
   }
   cout << freq << " " << max << endl;
}

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

int main() {

    map<string,int> word_map;
    map<string,int>::iterator it;
    string s,freq_word,long_word;
    int freq_count=0;
    
    //cout << "???????????\?????????????????????" << endl;
    while (cin >> s) {
        it = word_map.find(s);
        if(it == word_map.end()){
            word_map.insert(map<string,int>::value_type(s,1));
            it = word_map.find(s);
        }
        else{
            (*it).second += 1;
        }
        //??????????????????
        if ((*it).second > freq_count) {
            freq_count = (*it).second;
            freq_word = s;
        }
        //?????°????¢????
        if (s.size() > long_word.size())
            long_word = s;
    
    }
    
    cout << freq_word << " " << long_word << endl;
}

C++: #include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
struct R{string word;
int nl;int ty;

};

int main(){

	struct R RR[1001]={};
	int i=0;
	string str;
	while(cin>>str){
		RR[i].word=str;RR[i].nl=str.size();RR[i].ty=0;
	i++;
	}
	
	for(int I=0;I<i;I++)
		for(int J=0;J<i;J++)
			if(RR[I].word==RR[J].word)RR[I].ty++;

	string x,y;
	int max1=0,max2=0;

	for(int I=0;I<i;I++)
	{//cout<<RR[I].ty<<endl;
		if(RR[I].nl>max1)x=RR[I].word;
	 if(RR[I].ty>max2)y=RR[I].word;}

	cout<<y<<" "<<x<<endl;
return 0;

}

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

using namespace std;

void solve()
{
	string word;
	map<string, int> Map;
	string ansLongWord;
	int maxLen = 0;
	while(cin >> word)
	{
		if(maxLen < word.size())
		{
			maxLen = word.size();
			ansLongWord = word;
		}
		++Map[word];
	}
	map<string, int>::iterator it = Map.begin();
	int maxCount = 0;
	string ansFreqWord;
	while(it != Map.end())
	{
		if(maxCount < it->second)
		{
			maxCount = it->second;
			ansFreqWord = it->first;
		}
		++it;
	}
	cout << ansFreqWord << " " << ansLongWord << endl;
}

int main()
{
	solve();
	return(0);
}

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

map<string,int> table;

int main(){
	string word, frequent, longest;
	int frequent_length = 0;
	while (cin >> word){
		table[word] += 1;
		if (table[word] > frequent_length){
			frequent_length = table[word];
			frequent = word;
		}
		longest = (word.size() > longest.size()) ? word : longest;
	}	
	cout << frequent << ' ' << longest << endl;
	return 0;
}

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

int main() {
	string str[1000],tmp;
	int a[1000] = {}, flag = 0, max = 1, i, length = 0, num = 0;

	while (cin >> tmp) {
		if (flag == 0) {
			flag++;
			tmp[0] = tmp[0] - 'a';
		}
		for (i = 0; i < max; i++) {
			if (tmp == str[i]){
				a[i]++;
				break;
			}
		}
		if (i == max)
			str[i] = tmp;
	}

	if ((int)size(tmp) > length) {
		num = i;
		length = size(tmp);
	}

	cout << str[max] << " " << str[length] << endl;
	return 0;
}

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

using namespace std;

int main()
{
	char s[1000];
	int n=0;
	cin.getline(s,1000);
	string tok[1000];
	char *sep=" ,.";
	char *word;
	word = strtok(s,sep);
	while(word != NULL)
	{
		tok[n] = word;
		n++;
		word=strtok(NULL,sep);
	}
	int f=1,fmax=1;
	string max, freq;
	max=tok[0]; freq=tok[0];
	for(int i=0;i<n;i++)
	{
		if(tok[i].length()>max.length())
			max=tok[i];
		f=1;
		for(int j=i+1;j<n;j++){
			if(tok[i]==tok[j])
				f++;
		}
		if(f>fmax)
		{
			fmax=f; freq=tok[i];
		}
	}
	cout << freq <<" " <<max;
}