Go: package main

import (
	"bufio"
	"os"
	"strings"
	"fmt"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	words := strings.Split(scanner.Text(), " ")
	wordMap := make(map[string]int)
	for _, v := range words {
		wordMap[v]++
	}
	key := ""
	value := -1
	l := -1
	word := ""
	for k, v := range wordMap {
		// fmt.Println(k, v)
		if value < v {
			key = k
			value = v
		}
		if l < len(k) {
			l = len(k)
			word = k
		}
	}

	fmt.Println(key, word)
	// fmt.Println(wordMap)
}

C++: #include <string.h>
#include <string>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>

#define ll (long lon
#define REP(i,n) for(int i = 0;i<(int)n;i++)
#define FOR(i,a,b) for(int i = (a);i < (b);i++)
#define RFOR(i,a,b) for(int i = (a);i>(b);i--)

using namespace std;

int main (void){
    
    char str[1000];
    gets(str);
    char tango[500][33];
    int i = 0,j = 0,k = 0,l = 0, temp = 0,m = 0;
    char max[33];
    int max_l = INT_MIN;
    int max_numer = 0;
    int yokuderu = 0;
    int yokuderu_temp = 0;
    int yokuderu_number = 0;
    while(str[i++] != '\0')
    {
        if(str[i-1] == ' ')
        {
            if((i-1)-temp>max_l)
            {
                max_l = (i-1) -temp;
                max_numer = j;
            }
            while(temp<i-1)
                tango[j][l++] = str[temp++];
            temp = i;
            j++;
            l = 0;
        }
    }
    
 
        if((i-1)-temp>max_l)
        {
            max_l = (i-1) -temp;
            max_numer = j;
        }
        while(temp<i-1)
            tango[j][l++] = str[temp++];
        temp = i;
        j++;
        l = 0;
    /*???????????§??????????????????*/
    //cout <<"number is " << j << endl;
    
    for(int m = 0; m < j;m++)
    {
        for(int k = 0; k<j;k++)
        {
            if(m != k)
            {
                if(strcmp(tango[m], tango[k]) == 0)
                {
                    yokuderu_temp++;
                }
            }
        }
        if(yokuderu_temp >= yokuderu)
        {
            yokuderu = yokuderu_temp;
            yokuderu_number = m;
        }
        yokuderu_temp = 0;
    }
    REP(i,32)
    cout << tango[yokuderu_number][i];
    cout << " ";
    while(tango[max_numer][m++] != '\0')
        cout << tango[max_numer][m-1];
    m = 0;
        cout << endl;
    
    
    return 0;
}

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

int main() {
  string str, mf, ml;
  map<string, int> mp;
  while (cin >> str) {
    mp[str]++;
    if (mp[str] > mp[mf]) mf = str;
    if (str.length() > ml.length()) ml = str;
  }
  cout << mf << " " << ml << endl;
}

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

int main() {
	string str[1000],tmp;
	int a[1000] = {}, flag = 0, max = 1, i, length = 0, num = 0;

	while (cin >> tmp) {
		if (flag == 0) {
			flag++;
			tmp[0] = tmp[0] - 'a';
		}
		for (i = 0; i < max; i++) {
			if (tmp == str[i]){
				a[i]++;
				break;
			}
		}
		if (i == max)
			str[i] = tmp;
	}

	if ((int)size(tmp) > length) {
		num = i;
		length = size(tmp);
	}

	cout << str[max] << " " << str[length] << endl;
	return 0;
}

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

using namespace std;

#define int long long
#define PB push_back
#define PPB pop_back
typedef pair<int, int> pii;
static const int INF = 1LL<<61;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  string ans1, ans2, in;
  map<string, int> gedo;
  while (cin >> in) {
    if (ans2.size() < in.size()) ans2 = in;
    gedo[in]++;
  }

  int tm = 0;
  for (auto it = gedo.begin(); it != gedo.end(); ++it)
    if (tm < (*it).second) {
      ans1 = (*it).first;
      tm = (*it).second;
    }

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

  return 0;
}

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

int main()
{	
	string s, t;
	map<string, int> p;

	while (cin >> s) {
		if (p.find(s) != p.end())
			p[s]++;
		else
			p[s] = 1;

		if (s.size() > t.size())
			t = s;
	}

	int m = 0;

	for (map<string, int>::iterator itr = p.begin(); itr != p.end(); itr++)
		m = max(m, itr->second);

	for (map<string, int>::iterator itr = p.begin(); itr != p.end(); itr++)
		if (itr->second == m)
			cout << itr->first << " " << t << endl;

	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
int main(){
	char ans[50][10000] = {{0}};
	char a[10000] = {0};
	scanf("%[^\n]",a);
	int cnt = 0;
	int mx_len = 0;
	char date[10000] = {0};
	a[strlen(a)] = ' ';
	for(int i = 0,j = 0; i <= strlen(a); i++){
        if(a[i] >= 'a' && a[i] <= 'z' || a[i] >= 'A' && a[i] <= 'Z'){
            ans[cnt][j] = a[i];
            j++;
        }
        else{
            if(mx_len < j){
                strncpy(date,a+i-j,j);
                mx_len = max(mx_len,j);
            }
            cnt++;
            j = 0;
        }
	}
	for(int i = 0; i < cnt; i++){
        cout << ans[i] << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <cstdlib>
#include <queue>
#include <vector>
#include <unordered_set>
#include <map>
using namespace std;
int main() {
	string s,f,l;
	map<string,int> table;
	size_t n=0;
	while( cin  >> s ) { 
		table[s] += 1;
		if ( table[s] > n ) {
			n = table[s];
			f = s;
		}
		if (s.size() > l.size() ) l = s;
	}
}

C++: //48
#include<iostream>
#include<map>
#include<algorithm>

using namespace std;

bool cmp(pair<string,int> a,pair<string,int> b){
  return a.second<b.second;
}

int main(){
  string ml;
  map<string,int> wc;
  for(string s;cin>>s;){
    if(ml.size()<s.size()){
      ml=s;
    }
    wc[s]++;
  }
  cout<<max_element(wc.begin(),wc.end(),cmp)->first<<' '<<ml<<endl;
  return 0;
}

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

typedef const pair<string, int> PSI;

bool cmpCount(PSI &T1, PSI &T2) {
	return T1.second < T2.second;
}

bool cmpLength(PSI &T1, PSI &T2) {
	return T1.first.length() < T2.first.length();
}

int main() {
	string str;
	map<string, int> M;

	while(cin >> str) {
		M[str]++;
	}

	PSI maxCount = *max_element(M.begin(), M.end(), cmpCount);
	PSI maxLength = *max_element(M.begin(), M.end(), cmpLength);

	cout << maxCount.first << " " << maxLength.first << endl;

	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main (){
	int n,m;
	cin>>n>>m;
	int a[n][m];
	int s[100000];
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>a[i][j];
			s[i]=s[i]+a[i][j];
		}
	}
	    for(int i=0;i<n;i++){
	    	for(int j=0;j<n;j++){
	    		cout<<a[i][j]<<"";
	    	}
	    	cout<<s[i]<<endl;

	    }

}

C++: #include<iostream>
#include<string>
#include<map>
#include<cstring>
#include<cstdio>
using namespace std;
int main()
{
    map<string,int> str;
    string word;
    int big = 0;
    int cnt = 0;
    string keepword;
    string keepstr = "";
    string many = "";

    while(!cin.eof()){
        cin >> word;
        string kari(word);
        str[kari]++;

        if(cnt < str[kari]){
          cnt = str[kari];
          keepstr = kari;
        }

        if(big < word.size()){
          big = word.size();
          keepword = word;
        }
    }
    cout << keepstr << " " << big << endl;
}

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

using namespace std;

int main()
{
	string s, max="";
	map<string, int> m;
	while(cin >> s) {
		if(s.size() > max.size()) {
			max = s;
		}
		m[s]++;
	}
	map<string, int>::reverse_iterator p = m.rbegin();
	cout << (*p).first << " " << max << endl;
}