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<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;
int main(){
string n,t;
int ms=0;
map<string,int>ta;
	while(cin>>n){
	ta[n]++;
	if( ms<n.size() )ms=n.size(),t=n;
	}
	string a;
	ms=0;
	for(map<string,int>::iterator it=ta.begin();it!=ta.end();it++){
		if(ms<(*it).second)ms=(*it).second,a=(*it).first;
	}
	
	cout<<a<<" "<<t<<endl;

	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
#include <string> 
#include <string.h>
#include <utility>
using namespace std;


int main(){
	string str;
	char word[35][35];
	int x=0,y=0,i=0,j,length=0,maxl=0,maxq[35],q,p=0;maxq[0]=0;
	getline(cin,str);
	while(1){
		if(str[i]==' '){
			word[y][x]='\0';
			x=0;
			y++;
		}
		else if(str[i]=='\0'){
			word[y][x]='\0';
			word[y+1][0]='\0';
			break;
		}
		else{
			word[y][x]=str[i];
			x++;
		}
		i++;
	}
	for(i=0;i<y;i++){
		for(j=0;j<y-i;j++){
			if(strcmp(word[j],word[j+1])>0){
				for(x=0;x<35;x++){
					swap(word[j][x],word[j+1][x]);
				}
			}
		}
	}
	for(i=0;i<=y;i++){
		for(j=0;word[i][j]!='\0';j++){}
		if(maxl<j){
			maxl=j;
			length=i;
		}
		if(strcmp(word[i],word[i+1])==0){
			maxq[i+1]=maxq[i]+1;
		}
		else{
			maxq[i+1]=0;
		}
	}
	for(i=0;i<=y;i++){
		if(p<maxq[i]){
			p=maxq[i];
			q=i;
		}
	}
	printf("%s %s\n",word[q],word[length]);
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    map<string,int> cnt;
    string s,ans1,ans2;
    int mx1=0,mx2=0;
    while (cin>>s) {
        cnt[s]++;
        if (cnt[s]>mx1) {
            mx1=cnt[s];
            ans1=s;
        }
        if (s.size()>mx2) {
            mx2=s.size();
            ans2=s;
        }
    }
    cout<<ans1<<' '<<ans2<<endl;
    return 0;
}

C++: #include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
 string s, max("");
 map<string, int> m;
 map<int, string> x;

 while(cin>>s){
  if(s.size() > max.size())
  max = s;
  m[s]++;
 }

 for(map<string, int>::iterator it = m.begin(); it != m.end(); it++){
  x[(*it).second] = (*it).first;
  cout<<(*it).first;
 }

 cout<<(*x.rbegin()).second<<" "<<max<<endl;
 return 0;
}

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, times=0;
    string tmp,maxLength,maxTimes;
    map<string, int> sentences;
    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]++;
        }
        if(sentences[tmp]>times){
            times=sentences[tmp];
            maxTimes=tmp;
        }
    }
    cout << maxTimes << " " << maxLength << endl;
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<map>
using namespace std;
int main(){
  map<string,int> t;
  string s, mxc, mxl;
  int freq = 1, len = 0;
  while(cin >> s){
    if(t.find(s) == t.end()){
      t[s] = 1;
    }
    else{
      t[s]++;
    }

    if(t[s] > freq){
      freq = t[s];
      mxc = s;
    }
    if(s.size() > len){
      len = s.size();
      mxl = s;
    }
  }
  cout << mxc << " " << mxl << endl;
}

C++: #include <iostream>
#include <string>
#include <map>
using namespace std;int M,l;main(){string s,t,u;map<string,int>m;for(;cin>>u;t=t.size()<u.size()?u:t)if(++m[u]>M)M=m[u],s=u;cout<<s<<' '<<t<<endl;}

C++: #include <bits/stdc++.h>
using namespace std;

typedef complex<double> P;

string l(string s){
	//if( s[0] <= 'Z' ) s[0] = s[0] - 'Z' + 'z';
	return s;
}

int main(){
	map<string,int> d;
	string s;
	int mx = 0;
	string v = "";
	while( cin >> s ){
		mx = max(mx,++d[l(s)]);
		if( v.size() < s.size() ) 
			v = l(s);
	}
	for( auto i : d)
		if( mx == i.second) cout << i.first << " ";
	cout << v << endl;
		
	
			
			
}

C++: #include<bits/stdc++.h>
using namespace std;


typedef pair<string,int> p;
vector <p> ls(0);


int find(string s){
  for(int i=0; i<(int)ls.size(); i++){
    if(s==ls[i].first)return true;
  }
  return -1;
}

int main(){

  string in;
  int max=0,indx=0;
  string maxs="";

  while(cin>>in){
    int tmp=find(in);
    if(tmp==-1){
      ls.push_back( p(in,1) );
      if(in.size()>maxs.size()){ maxs = in;}
    }
    else{
      ls[tmp].second++;
      if(ls[tmp].second>max){
        max=ls[tmp].second;
        indx = tmp;
      }
    }

  }

  cout << ls[indx].first << " " << maxs << endl;

  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<map>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

int main(){
  map<string,int> m;
  string str;
  string ans1 = "";
  string ans2 = "";
  int cnt = 0;
  while(cin>>str) m[str]++;
  FOR(it,m){
    if(it->f.size() > ans2.size())
      ans2 = it->f;
    if(cnt < it->s){
      ans1 = it->f;
      cnt  = it->s;
    }
  }
  cout << ans1 << " " << ans2 << endl;
  return 0;
}

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

char str[50];
char word[1000][50];
int count[1000];

int main(void)
{
	int i, j, ind, ind2;
	int c, len = 0;
	i = 0;
	
	while (scanf("%s", str) != EOF){
		
		c = 1;
		for (j = 0; j < i; j++){
			
			if (strcmp(str, word[j]) == 0){
				count[j]++;
				c = 0;
			}
		}
		
		if (c == 1){
			strcpy(word[i], str);
			
			if (strlen(word[i]) > len){
				len = strlen(word[i]);
				ind = i;
			}
			i++;
		}
	}
	ind2 = 0;
	
	for (j = 0; j < i; j++){
		
		if (count[ind2] < count[j]){
			ind2 = j;
		}
	}
	
	printf("%s %s\n", word[ind2], word[ind]);
	
	return (0);
}

C++: #include<stdio.h>
#include<string.h>

int main(void)
{
  char s[40] = {};
  char str[1001][40] = {};
  int i;
  int count[1001];
  int longest = 0;
  int max = 0;
  char ans[2][40] = {};
  while(scanf("%s", s) != EOF){
    if(longest < strlen(s)){
      strcpy(ans[0], s);
      longest = strlen(s);
    }
    
    for(i = 0;;i++) { 
      if(strcmp(s, str[i]) == 0 ){
	count[i]++;
	break;
      }
    
      if (count[i] == 0){
	count[i]++;
	strcpy(str[i], s);
	break;
      }
    }

    for(i = 0; i < 1001; i++)
      if( max < count[i] ){
	max = count[i];
	strcpy(ans[1], str[i]);
      }
  }
  
  printf("%s %s\n", ans[1], ans[0]);

  return 0;
}