Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

type Pair struct {
	key   string
	value int
}

func main() {
	scanner.Split(bufio.ScanWords)
	counts := map[string]int{}
	maxLen := 0
	maxLenWord := ""
	for {
		word := nextString()
		if word == "" {
			break
		}

		counts[word]++

		if len(word) > maxLen {
			maxLen = len(word)
			maxLenWord = word
		}
	}

	mapPairs := []Pair{}
	for k, v := range counts {
		mapPairs = append(mapPairs, Pair{k, v})
	}
	sort.Slice(mapPairs, func(i, j int) bool { return mapPairs[i].value > mapPairs[j].value })

	fmt.Println(mapPairs[0].key, maxLenWord)
}

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

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

using namespace std;

int
main(void)
{
	char line[1002];

	if (fgets(line, sizeof line, stdin) == NULL) {
		return 0;
	}

	char* token = strtok(line, " \n");

	map<string, int> s;
	int m = 0;
	string ms;

	while (token) {
		string ts(token);

		if (s.find(ts) == s.end()) {
			s[ts] = 0;
		}
		s[ts] ++;

		if (m < (int)(ts.size())) {
			m = ts.size();
			ms = ts;
		}
		
		token = strtok(NULL, " \n");
	}

	if (!s.empty()) {
		auto itr = max_element(s.begin(), s.end(),
			[](const pair<string, int>& a, const pair<string, int>& b)
				-> bool {
					return (a.second < b.second);
				});
				
		printf("%s %s\n", (*itr).first.c_str(), ms.c_str());
	}

	return 0;
}

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

int main()
{
	map<string, int> cnt;
	string s;
	while (cin >> s) {
		cnt[s]++;
	}
	int ma = 0, le = 0;
	string res1, res2;
	for (auto p : cnt) {
		if (p.second > ma) {
			ma = p.second;
			res1 = p.first;
		}
		if ((int)p.first.size() > le) {
			le = p.first.size();
			res2 = p.first;
		}
	}
	cout << res1 << ' ' << res2 << endl;
	return 0;
}

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

map<string, int> mp;

int main()
{
	string str;
	string maxi;
	string maxl;
	
	while (!cin.eof()){
		cin >> str;
		mp[str]++;
		if (mp[maxi] < mp[str]){
			maxi = str;
		}
		if (maxl.size() < str.size()){
			maxl = str;
		}
	}
	
	cout << maxi << " " << maxl << endl;
	
	return 0;
}