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>
using namespace std;
int main(){
    long saidai=0;
    int a=0,cnt=0,num=0,max=0,t;
    string str,tango[1000]={""},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<=cnt;k++){
        if(saidai<tango[k].size()){
            saidai=tango[k].size();
            ans=tango[k];
        }
    }
    
    for(int s=0;s<cnt;s++){
        num=1;
        for(t=s+1;t<=cnt;t++){
            if(tango[s]==tango[t]){
                num=num+1;
            }
        }
        if(max<num){
            max=num;
            answer=tango[s];
        }
    }
    
    for(int x=0;x<=cnt;x++){
        cout<<" "<<tango[x];
    }cout<<endl;
    cout<<max<<" "<<saidai<<endl;
    cout<<answer<<" "<<ans<<endl;
    return 0;
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>

using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

int dx[]={-1,1,0,0};
int dy[]={0,0,-1,1};

vector<string> split(const string& s, char c = ' '){
	vector<string> ret;
	string t; 
	stringstream ss(s);
	while(getline(ss, t, c)){
		ret.pb(t);
	}
	return ret;
}

int main(){
	string s;
	getline(cin,s);
	map<string, int> mp;
	vector<string> v = split(s);
	rep(i, v.size()){
		mp[v[i]]++;
	}
	string m, l;
	int a = 0;
	for(auto p : mp){
		if(a < p.se) m = p.fi, a = p.se;
		if(l.size() < p.fi.size()) l = p.fi;
	}
	cout<<m<<" "<<l<<endl;
}

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

int main() {
	//??£?¨?
	int most_views = 0,views=0,most_long=0,len=0;
	char tmp_sentence[1000];
	string sentence,mo_ma_word,longest_word,word="";
	vector<string> words;

	cin.getline(tmp_sentence, sizeof(tmp_sentence));
	sentence = tmp_sentence;
	for (int i = 0; i < sentence.size(); i++) {
		if (sentence[i] == ' ') { words.push_back(word); word = ""; }
		else word = word + sentence[i];
	}
	words.push_back(word);
	for (int i = 0; i < words.size(); i++) {
		for (int j = 0; j < words.size(); j++) {
			if (words[i] == words[j])views++;
		}
		if (most_views < views) {
			most_views = views;
			mo_ma_word = words[i];
		}
		views = 0;
	}
	for (int i = 0; i < words.size(); i++) {
		if (most_long < words[i].size())longest_word = words[i];
	}
	cout << mo_ma_word <<' '<<longest_word;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <cstring>
#include <functional>

using namespace std;

#define REP(i,a,b) for((i)=(a);(i)<(int)(b);(i)++)
#define rep(i,n) REP(i,0,n)
// BEGIN CUT HERE
#define foreach(itr,c) for(typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
// END CUT HERE

int main(){
  int i, mlen = 0, mdeta = 0, deta = 0, len = 0, leni,j, detai;
  string str;
  vector<string> data;

  while(cin >> str) data.push_back(str);

  rep(i,data.size()){
    deta = 0;
    rep(j,data.size()){
      if(data[i] == data[j]) deta++;
      len = data[i].size();
      if(mlen < len){
        mlen = len;
        leni = i;
      }
      if(mdeta < deta){
        mdeta = deta;
        detai = i;
      }
    }
  }

  cout << data[detai] << " " << data[leni] << endl;

  return 0;
}

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

using namespace std;

int maxlen = 0, mode = 0;
map<string,int> mp;

int main()
{   
    string len_key, mode_key, s2;
    int m = 9;
    while( cin >> s2 )
    {
        mp[s2]++;
        if( mode < mp[s2] )
        {
            mode = mp[s2];
            mode_key = s2;
        }
        if( maxlen < s2.size() )
        {
            maxlen = s2.size();
            len_key = s2; 
        } 
    }

    cout << mode_key << ' ' << len_key << '\n';
    return 0;
}

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

int main(){
	int max = 0;
	string max_str;

	string str;
	vector<string> v;
	while(cin >> str){
		transform(str.begin(), str.end(), str.begin(), ::tolower);

		v.push_back(str);

		if(str.length() > max){
			max_str = str;
		}
	}
	sort(v.rbegin(), v.rend());
	cout << v[0] << " " << max_str << endl;
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    map<string, int> m;
    int maxNum = 0;
    string ret1;
    int maxLength = 0;
    string ret2;

    for(;;){
        string s;
        if(!(cin >> s))
            break;

        int num = ++ m[s];
        if(num > maxNum){
            maxNum = num;
            ret1 = s;
        }

        if(s.size() > maxLength){
            maxLength = s.size();
            ret2 = s;
        }
    }

    cout << ret1 << ' ' << ret2 << endl;
    return 0;
}

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

int main(){
	map<string,int> data;
	string ans1,ans2,str;
	while(cin >> str){
		data[str]++;
		if(data[ans1] < data[str]) ans1 = str;
		if(ans2.size() < str.size() ) ans2 = str;
	}
	cout << ans1 << " " << ans2 << endl;
}

C++: #if 0

#endif

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

map<string, int> M;

int main() {
  string word, long_word, freq_word;
  int cnt = 0, length = 0;
  while (cin >> word) {
    if (M.count(word))
      M[word]++;
    else
      M[word] = 1;
    if (M[word] > cnt) {
      cnt = M[word];
      freq_word = word;
    }
    if (word.length() > length) {
      length = word.length();
      long_word = word;
    }
  }
  cout << freq_word << ' ' << long_word << endl;
}

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

using namespace std;

int main(void){

	string str[1010];
	int num[1010]={0};
	char inp[41];
	int max=0,max2=0;
	while(scanf("%s",&inp)!=EOF){
		for(int i=0;;i++){
			if(str[i].empty()==1){
				str[i]=inp;
				num[i]++;
				break;
			}
			if(str[i]==inp){
				num[i]++;
				break;
			}
		}
	}

		for(int i=1;!str[i].empty();i++){
			if(str[max].size()<str[i].size()) max=i;
			if(num[max2]<num[i]) max2=i;
		}
	cout<<str[max2]<<" "<<str[max]<<endl;

	return 0;
}