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>

int main(){
  std::string str;
  std::string maxlen;
  std::string maxocc;
  map<std::string, int> occ;
  //std::cin >> str;
  //std::cout << str << std::endl;

  std::cin >> str;
  maxlen = str;
  maxocc = str;

  while(std::cin >> str){
    if(str.size()>maxlen.size()){
      maxlen = str;
    }
    occ[str]++;
    if(occ[str]>occ[maxocc]){
      maxocc = str;
    }
  }

  std::cout << maxlen << std::endl;
}

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<string>
#include<vector>

using namespace std;

int main()
{
	vector<string> words;

	string str,tmp,tmpl;
	int max=0;
	int maxl=0;

	while(cin>>str)
		words.push_back(str);
	for(int i=0;i<words.size();i++){
		int c=0;
		int cl=words.at(i).size();
		for(int j=i+1;j<words.size();j++){
			if(words.at(i)==words.at(j)){
				c++;
			}
		}
		if(c>max){
			max=c;
			tmp=words.at(i);
		}
		if(cl>maxl){
			maxl=cl;
			tmpl=words.at(i);
		}
	}

	cout<<tmp<<" "<<tmpl<<endl;
	return 0;
}

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




using namespace std;
struct ST{string str;int c;int z;};

int main(){

int i=0;
string str,sth,stl;
struct ST P[1001];
int max=0;
while(cin>>str){
	for(int  j=0;j<str.size();j++)
	str[j]=tolower(str[j]);
 
//	for(int j=0;j<str.size();j++)
//	str[i] = tolower( str[i] );

P[i].str=str;P[i].c=0;P[i].z=(int)str.size();
i++;
}
for(int j=0;j<i;j++)
for(int k=i-1;k>j;k--)
	if(P[k-1].str>P[k].str)
//if(P[k-1].str>P[k].str)
//if(strcmp(P[k-1].str,P[k].str)>0)
{


struct ST TEM=P[k-1];P[k-1]=P[k];P[k]=TEM;
//cout<<"*";
}

for(int j=1;j<i;j++)
{if(P[j-1].str==P[j].str)P[j].c++;

}
max=0;
for(int j=0;j<i;j++)
{if(max<P[j].c){max=P[j].c;sth=P[j].str;}}
max=0;
for(int j=0;j<i;j++)
	if(P[j].z>max){max=P[j].z;stl=P[j].str;}

cout<<sth<<" "<<stl<<endl;

//for(int j=0;j<i;j++)
//	cout<<P[j].str<<P[j].z<<endl;

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;
}

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




using namespace std;
struct ST{string str;int c;int z;};

int main(){

int i=0;
string str,sth,stl;
struct ST P[1001];
int max=0;
while(cin>>str){
	for(int  j=0;j<str.size();j++)
	str[j]=tolower(str[j]);
 
//	for(int j=0;j<str.size();j++)
//	str[i] = tolower( str[i] );

P[i].str=str;P[i].c=0;P[i].z=(int)str.size();
i++;
}
for(int j=0;j<i;j++)
for(int k=i-1;k>j;k--)
	if(P[k-1].str>P[k].str)
//if(P[k-1].str>P[k].str)
//if(strcmp(P[k-1].str,P[k].str)>0)
{


struct ST TEM=P[k-1];P[k-1]=P[k];P[k]=TEM;
//cout<<"*";
}

for(int j=1;j<i;j++)
{if(P[j-1].str==P[j].str)P[j].c++;

}
max=0;
for(int j=0;j<i;j++)
{if(max<P[j].c){max=P[j].c;sth=P[j].str;}}
max=0;
for(int j=0;j<i;j++)
	if(P[j].z>max){max=P[j].z;stl=P[j].str;}

cout<<sth<<" "<<stl<<endl;

//for(int j=0;j<i;j++)
//	cout<<P[j].str<<P[j].z<<endl;

return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>

//#define PI 3.141592653589

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;
	
	return 0;
}

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=I+1;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++: //English Sentence
#include<bits/stdc++.h>
using namespace std;

map<string, int> d;

int main(){
  int max_n=0, max_len=0;
  string s, n_s, len_s;
  while(cin>>s){
    if(max_len<s.length()){
      len_s=s;
      max_len=s.length();
    }
    d[s]++;
    if(max_n<d[s]){
      n_s=s;
      max_n=d[s];
    }
  }
  cout<<n_s<<' '<<len_s<<endl;
  return 0;
}

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])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] << " " << maxs << endl;

  return 0;
}

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

int main() {
  std::string s;
  std::map<std::string, int> m;

  while (std::cin >> s) {
    decltype(m)::iterator it = m.find(s);

    if (it == m.end()) {
      m.insert(std::make_pair(s, 1));
    } else {
      it->second++;
    }
  }

  int mode = 0;
  decltype(m)::iterator modePair;
  int maxLen = 0;
  decltype(m)::iterator maxLenPair;

  for (decltype(m)::iterator i = m.begin(); i != m.end(); ++i) {
    if (mode < i->second) {
      mode = i->second;
      modePair = i;
    }

    if (maxLen < i->first.length()) {
      maxLen = i->first.length();
      maxLenPair = i;
    }
  }

  std::cout << modePair->first << " " << maxLenPair->first << std::endl;


  return 0;
}