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 <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	map<string,int> ma;
	string s;
	pair<int,string> m1(0,"");
	pair<int,string> m2(0,"");
	while(cin>>s){
		if(ma.count(s)==0) ma[s]=0;
		ma[s]++;
		maxs(m1,mkp((int)s.size(),s));
	}
	for(auto x:ma){
		maxs(m2,mkp(x.S,x.F));
	}
	cout<<m2.S<<" "<<m1.S<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

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

using namespace std;

int main(){
	string str,manyStr,longStr;
	map<string, int> m;
	int cnt = 1;
	int length = 0;
	while(cin >> str){
		m[str]++;
	}
	for(auto it = m.begin(); it != m.end(); it++){
		if(it->first.size() > length){
			length = it->first.size();
			longStr = it->first;
		}
		if(it->second > cnt){
			cnt = it->second;
			manyStr = it->first;
		}
	}
	cout << manyStr << " " << longStr << endl;
}

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};
	int j = 0;
	int len = 0;
	for(int i = 0; a[i] != 0; i++) len++;
	a[len] = ' ';
	for(int i = 0; i <= len; i++){
        if(a[i] != ' '){
            ans[cnt][j] = a[i];
            j++;
        }
        else{
            cnt++;
            j = 0;
        }
	}
	for(int i = 0; i < cnt; i++) cout << ans[i] << endl;
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
int main(){
	char ans[40][1000] = {{0}};
	char a[1000] = {0};
	scanf("%[^\n]",a);
	int cnt = 0;
	int mx_len = 0;
	char date[1000] = {0};
	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;
        }
	}
	char da[1000] = {0};
	int check[1000] = {0};
	for(int i = 0; i < cnt; i++){
        for(int j = i; j < cnt; j++){
            if(i != j){
                if(strcmp(ans[i],ans[j]) == 0){
                    fill(ans[j],ans[j]+1000,-1);
                    check[i]++;
                }
            }
        }
	}
	mx_len = 0;
	char mx_date[1000] = {0};
	for(int i = 0; i < cnt; i++){
	    if(mx_len < check[i]){
	        strcpy(mx_date,ans[i]);
            mx_len = max(mx_len,check[i]);
	    }
	}
    cout << mx_date << " "<< date << endl;
	return 0;
}

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

int main()
{
	std::map<std::string, int> count_map;
	std::string str{};
	int max_length = 0;
	std::string max_str{};
	while (std::cin >> str)
	{
		if (count_map.count(str) == 0)
		{
			count_map[str] = 1;
		}
		else
		{
			count_map[str]++;
		}
		if (max_length < str.length())
		{
			max_length = str.length();
			max_str = str;
		}
	}

	int max_count = 0;
	std::string max_string{};
	for (auto counter : count_map)
	{
		if (max_count < counter.second)
		{
			max_count = counter.second;
			max_string = counter.first;
		}
	}

	std::cout << max_string << " " << max_str << std::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[1010][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<iostream>
#include<string>
#include<functional>
#include<algorithm>
using namespace std;

int main(){
	string sentence[1000];
	int sentenceNum[1000];
	int array[1000];
	string input;
	int count = 0;
	bool flag;
	int maxLength = 0;

	for(int i=0; i < 1000; i++) sentenceNum[i] = 0;

	while(cin >> input){
		flag = false;
		if(!count){
			sentence[0] = input;
			sentenceNum[0]++;
			count++;
			int inputSize = input.size();
			maxLength = max(maxLength, inputSize);
		}

		else {
			for(int i=0; i < count; i++){
				if(sentence[i] == input){
					sentenceNum[i]++;
					flag = true;
					break;
				}
			}
			if(!flag){
				sentence[count] = input;
				sentenceNum[count]++;
				count++;
				int inputSize = input.size();
				maxLength = max(maxLength, inputSize);
			}
		}
	}

	for(int i=0; i < 1000; i++) array[i] = sentenceNum[i];

	sort(array, array+1000, greater<int>());

	for(int i=0; i< count; i++){
		if(array[0] == sentenceNum[i]){
			cout << sentence[i];
		}
	}
	for(int i=0; i< count; i++){
		int sentenceSize = sentence[i].size();
		if(maxLength == sentenceSize){
			cout << " " << sentence[i] << endl;
		}
	}
}