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 <stdio.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
#define TT 35

map <string, int> S;

int max_len,  max_time;
char str[TT], tmp_max_len[TT], tmp_max_time[TT];

void init(){
	max_len = 0,  max_time = 0;
}

void solve(){
	S[str] ++;
	if (max_time < S[str]){
		strcpy(tmp_max_time, str);
		max_time = S[str];
	}
	int len = strlen(str);
	if (max_len < len){
		strcpy(tmp_max_len, str); 
		max_len = len;
	}
}

int main (){
	init();
	while (~scanf("%s", str)){
		solve();
	}
	printf("%s %s\n", tmp_max_time, tmp_max_len);
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <map>
using namespace std;
int main(){
	string s,tmp,lw,histw;
	map<string,int> count;
	int maxh=0,maxl=0;
	getline(cin,s);
	stringstream ss;
	ss<<s;
	while(ss>>tmp){
		if(count.find(tmp)!=count.end())++count[tmp];
		else count[tmp]=1;
		if(count[tmp]>maxh){
			maxh=count[tmp];
			histw=tmp;
		}
		if(tmp.length()>lw.length())lw=tmp;
	}
	cout<<histw<<" "<<lw<<"\n";
	return 0;
}

C++: a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c)

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <map>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;

int main()
{
	map<string, int> m;
	string best;
	string longest;
	
	char word[33];
	while(scanf("%s", word) != EOF){
		string s(word);
		if(m.count(s))
			m[s]++;
		else
			m[s] = 1;

		if(m[best] < m[s])
			best = s;
		if(longest.size() < s.size())
			longest = s;
	}
	printf("%s %s\n", best.c_str(), longest.c_str());

	return 0;
}

C++: #include <iostream>
#include <map>
using namespace std;
#define F first
#define S second
int main(){
    string s,ans,lon;
    map<string,int>m;
    int top=0;
    while(cin>>s){
        m[s]++;
        if(s.size()>lon.size())lon=s;
    }
    for(pair<string,int> i:m){
        if(i.S>top){
            top=i.S;
            ans=i.F;
        }
    }
    cout<<ans<<' '<<lon<<endl;
}

C++: #include<iostream>
#include<string>
#include<map>
#include<cctype>
using namespace std;
int main(){
	map<string, int> mpa;
	string most_frequent_word, longest_word;
	string s;
	int max_frequency = 0, max_length = 0;
	while(cin >> s){
		if(s.length() > max_length){
			max_length = s.length();
			longest_word = s;
		}
		for(int i = 0; i < s.length(); i++) s[i] = tolower(s[i]);
		mpa[s]++;
	}
	for(auto e : mpa){
		if(e.second > max_frequency){
			max_frequency = e.second;
			most_frequent_word = e.first;
		}
	}
	cout << most_frequent_word << ' ' << longest_word << endl;
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
    long saidai=0;
    int a=0,cnt=0,num=0,max=0;
    string str,tango[1000]={"0"},answer,ans;
    getline(cin,str);
    for(int i=0;i<str.size();i++){
        if(str[i]==' '){
            for(int j=a;j<i;j++){
                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]=="0"))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;
}

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

int main()
{
  int i = 0;
  string str;
  string freqstr;//最頻文字
  string longest;
  map<string,int> Map;
  while(cin >>str){
    if(i < ++Map[str]){
      i = Map[str];
      freqstr = str;
  }
    if(str.size() > longest.size())
      longest = str;
  }
  cout <<freqstr <<" "<<longest<<endl;
  return 0;
}

C++: #include <iostream>
#include <string>
#include <map>
#include <set>
 
using namespace std;
 
set<string> dic;
map<string,int> times;
 
int main(){
  int msize = 0;
  string str;
  string a,b;
  while(!cin.eof()){
    string in; cin >> in;
    dic.insert(in);
    times[in]++;
    if(msize < in.size()){
      str = in;
      msize = str.size();
    }
  }
  a = str;
  int mfreq = 0;
  for(set<string>::iterator it = dic.begin(); it != dic.end(); ++it){
    if(mfreq < times[*it]){
      mfreq = times[*it];
      str = *it;
    }
  }
  b = str;
  cout << b << " " << a << endl;
 
  return 0;
}

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

int main(void){
  vector<string> str;
  vector<int> cnt;
  string buf, maxstr;
  int max, ans, i;

  while(cin >> buf){
    bool f = true;

    if(max < buf.length()){
      max = buf.length();
      maxstr.append(buf);
    }
      
    for(i = 0; i < str.size(); i++){
      if(str[i] == buf){
	f = false;
	break;
      }
    }
    if(f){
      str.push_back(buf);
      cnt.push_back(1);
    }
    else{
      cnt[i]++;
    }
  }

  max = 0;
  for(i = 0; i < cnt.size(); i++){
    if(cnt[i] > max){
      max = cnt[i];
      ans = i;
    }
  }

  cout << str[i] << ' ' << maxstr << endl;

  return 0;
}

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

int main(){
	char str[1000];
	char word[33][33]={0};
	int longest=0;
	int check[33]={0};
	char *tmp;
	int freq=0;
	int count=0;
	int i,j;
	size_t len , prev;
	fgets(str , sizeof(str) , stdin);
		tmp=str;
		for(i=0 ; str[i]!='\0' ;i++){
			if(str[i]==' '){
				str[i]='\0';
				strcpy((char*)&word[count] , (const char*)tmp);
				tmp=str+i+1;
				count++;
			}
		}
		strcpy((char*)&word[count],(const char*)tmp);
		count++;
	for(i=0 ; i<count ; i++){
		for(j=i ; j<count ; j++){
			if(strcmp((const char*)&word[i] , (const char*)&word[j])==0){
				check[i]++;
			}
		}
	}
	for(i=0 ; i<count-1 ; i++){
		if(check[freq]<check[i+1]){
			freq=i+1;
		}
	}
		prev=strlen(word[0]);
	for (i=0 ; i<count ; i++){
		len=strlen(word[i]);
		if(len > prev){
			prev = len;
			longest=i;
		}	
	}
	cout << (char*)&(word[freq]) << " "<< (char*)&(word[longest]);
	return 0;
}

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

int main(){
	map<string,int> m;
	string s;
	while(cin >> s){
		m[s]++;
	}
	int max_word = 0;
	string ans1;
	/*出現頻度が最大*/
	for(map<string,int>::iterator it = m.begin(); it != m.end(); ++it){
		if(it->second > max_word){
			ans1 = it->first;
			max_word = it->second;
		}
	}

	int max_length = 0;
	string ans2;
	/*文字数が最大*/
	for(map<string,int>::iterator it = m.begin(); it != m.end(); ++it){
		if(it->first.size() > max_length){
			ans2 = it->first;
			max_length = it->first.size();
		}
	}

	cout << ans1 << " " << ans2 << endl;
}

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

int main(){
	string w[1000];
	int max=0,maxc=0,maxi=0,idx=0;
	for(int i=0;cin>>w[i];i++){
		if(w[i].size()>w[max].size()) max=i;
		idx++;
	}for(int i=0;i<idx;i++){
		int cnt=0;
		for(int j=0;j<idx;j++){
			if(w[i]==w[j]) cnt++;
		}if(cnt>maxc){
			maxi=i;
			maxc=cnt;
		}
	}cout<<w[maxi]<<" "<<w[max]<<endl;
	return 0;
}