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++: // English Sentence

#include <iostream>
#include <string>
#include <map>

using namespace std;

int main(void)
{
        map<string, int> tango; // 単語とその登場回数を記録する
        string s, highfre_str, maxlen_str;
        int appear = 0;

        while (cin >> s) {
                ++tango[s];
        }

        for (map<string, int>::const_iterator it = tango.begin();
             it != tango.end(); ++it) {
                if (it->second > appear) {
                        highfre_str = it->first;
                        appear = it->second;
                }

                if (it->first.size() > maxlen_str.size()) {
                        maxlen_str = it->first;
                }
        }

        cout << highfre_str << " " << maxlen_str << endl;

        return 0;
}

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

using namespace std;

int main(){
	string sent;
	string word[500];
	int a[500]={};
	int i,j,k,l;
	int n,m,len;
	i=0;
	while(cin>>sent){
		if(i==0){
			word[0]=sent;
			a[0]++;
			i++;
			len=sent.size();
			n=0;
		}
		else {
			if(len<sent.size()){
				len=sent.size();
				n=i;
			}
			for(j=0; j<i; j++){
				if(sent==word[j]){
					a[j]++;
					break;
				}
				if(j==i-1){
					word[i]=sent;
					a[i]++;
					i++;
					break;
				}
			}
		}
	}
	m=0;
	for(j=0; j<i; j++){
		if(m<a[j])m=j;
	}
	cout<<word[m]<<" "<<word[n]<<endl;
	// for(j=0; j<i; j++){
	// 	cout<<word[j]<<":"<<a[j]<<endl;
	// }
	//cout<<"len:"<<len<<" "<<word[n]<<endl;
	return 0;
}

C++: #include <iostream>
#include <string>
#include <map>
using namespace std;
map<string, int> table;
int main()
{
	string word, frequent, longest;
	size_t N = 0;
	while (cin >> word)
	{
		table[word]++;
		if (table[word] > N)frequest = word;
		if (word.size() > longest.size())longest = word;
	}
	cout >> frequent >> longest >> endl;
}

C++: #include <iostream>
#include <string>
#include <map>
using namespace std;
map<string,int> table;
int main () {
  string word, frequent, longest;
  size_t N=0; //??????????????????
  while (cin >> word) {
    table[word] += 1;
    if (table[word] > N) {
      N = table[word];
      frequent = word;
    }
    if (word.size() > longest.size()) longest = word;
  }
  cout << frequent << " " << longest;
}

C++: #include <cstdio>
#include <string>
#include <iostream>
#include <map>
 
using namespace std;
 
int main(){
  map<string,int> table;
  string word,ans1,ans2;
  int freq=0,len=0;
  while(cin >> word){
 
 
    if(table.find(word)==table.end()){
      table[word] = 1;
    }else{
      table[word]++;
    }
    if(table[word]>freq){
      freq = table[word];
      ans1 = word;
    }
    if(word.size()>len){
      len = word.size();
      ans2 = word;
    }
  }
  cout << ans1 << " " << ans2 << endl;
}

C++: #include <stdio.h>
#include<math.h>
using namespace std;

#define SIZE 1001

int main(){
	char buf[SIZE],longest[33],most_appear[33],tmp[33];
	fgets(buf,SIZE,stdin);
	int max_appear = -1,max_length = -1,tmp_length,tmp_count;

	for(int i=0,k=0;buf[i] != '\0';){	//?§????????????????
		tmp_length = 0;
		tmp_count = 0;
		for(k=i;buf[k] != '\0' && buf[k] != ' ';k++){
			tmp[0+(k-i)] = buf[k];
			tmp_length++;
		}
		if(max_length < tmp_length){ //??????????????´??°
			for(int p=0;p < tmp_length;p++){
				longest[p] = tmp[p];
				longest[p+1] = '\0';
			}
			max_length = tmp_length;
		}
		//??????????????????
		for(int p=0;buf[p] != '\0';){
			int t,match_count=0;
			for(t=0;buf[p+t] != '\0' && buf[p+t] != ' ' && t < tmp_length;t++){
				if(buf[p+t] == tmp[t] || buf[p+t] == tmp[t]-32 ||  buf[p+t] == tmp[t]+32){
					match_count++;
				}
			}
			if(match_count == tmp_length && buf[p+t] == ' ')tmp_count++;
			if(buf[p+t] != '\0'){
				p += (t+1);
			}else{
				break;
			}
		}
		if(max_appear < tmp_count){	//??????????????´??°
			for(int p=0;p < tmp_length;p++){
				most_appear[p] = tmp[p];
				most_appear[p+1] = '\0';
			}
			max_appear = tmp_count;
		}
		if(buf[k] != '\0'){
			i = k+1;
		}else{
			break;
		}
	}

	printf("%s %s\n",most_appear,longest);

    return 0;
}

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

using namespace std;

int main(){
  vector<string> tmpwords;
  map<string, int> words;
  string tmp;
  while(cin >> tmp){

    auto itr = words.find(tmp);
    if(itr!=words.end()){
      words[tmp]++;
    }
    else{
      words.insert( map<string, int>::value_type(tmp, 1));
      // cout << tmp << endl;
    }

  }

  // cout << "here" << endl;
  
  int max=0;
  string maxStr;
  int frequence=0;
  string freStr;
  for(auto itr=words.begin();itr != words.end(); ++itr){
    if(max < (itr->first.size())){
      max = (itr->first.size());
      maxStr = itr->first;
    }
    if(frequence < (itr->second)){
      frequence = itr->second;
      freStr = itr->first;
    }
  }

  cout << freStr << " " << maxStr << endl;
  
}

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

int main(){
	int k = 0;
	int kazu = 0;
	int num[1000] = {0};
	string str[1000];
	string hindo;
	string mozisuu = "";
	while(cin >> str[k]){
		for(int i = 0; i < k; i++){
			if(str[k] == str[i]){
				num[i]++;
				break;
			}
		}
		k++;
	}
	for(int i = 0; i < k; i++){
		if(num[i] > kazu){
			kazu = num[i];
			hindo = str[i];
		}
		if(str[i].size() > mozisuu.size()){
			mozisuu = str[i];
		}
	}
	cout << hindo << " " << mozisuu << endl;
}

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

int main(){
	string s, str1, str2;
	int maxn = 0;
	map<string, int> mp;
	while(cin >> s){
		mp[s]++;
		if(mp[s] > maxn){maxn = mp[s];str1 = s;}
		if(s.size() > str2.size())str2 = s;
	}
	cout << str1 << " " << str2 << endl;
	return 0; 
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
 
using namespace std;
 
const double eps=1e-10;
 
int main()
{
	map<string,int> m;
	int fre=0,len=0;
	string s,s_fre,s_len;

	while(cin>>s){
		m[s]++;
		if(s.size()>len){
			s_len=s;
			len=s.size();
		}
		if(m[s]>fre){
			s_fre=s;
			fre=m[s];
		}
	}

	cout<<s_fre<<" "<<s_len<<endl;


	return 0;
}

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

int main() {
  map<string,int> m;
  string s;
  int maxn = 0;
  string maxns;
  string maxls;
  while(cin >> s) {
    if(++m[s] > maxn) {
      maxn = m[s];
      maxns = s;
    }
    if(s.size() > maxls.size()) maxls = s;
  }
  cout << maxns << " " << maxls << endl;
  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

map<string, int> a;

int main()
{
    string t;
    string longest = "";
    string highest;
    int ma = 0;
    while (cin >> t) {
        if (ma < ++a[t]) ma = a[t], highest = t;
        if (longest.size() < t.size()) longest = t;
    }
    cout<<highest<<" "<<longest<<endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  map<string,int> a;
  string s,p,q;
  int c=0,k=0;
  while(cin>>s){
    a[s]++;
    if(c<s.size()){
      c=s.size();
      p=s;
    }
    if(k<a[s]){
      k=a[s];
      q=s;
    }
  }
  cout<<q<<' '<<s<<endl;
}