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

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

using namespace std;

int main(){
  string str;
  int max_len = 0;
  int max_fac = 0;
  string max_str1;
  string max_str2;
  map<string, int> map_str;
  while(cin >> str) {
    transform(str.begin(), str.end(), str.begin(), ::tolower);
    map_str[str]++;
  }

  map<string, int>::iterator it;
  for(it = map_str.begin(); it != map_str.end(); it++) {
    if(max_len < (it->first).size()) {
      max_len = (it->first).size();
      max_str1 = it->first;
    }
    if(max_fac < it->second) {
      max_fac = it->second;
      max_str2 = (it->first);
    }
  }

  cout << max_str2 << " " << max_str1 << endl;

  return 0;
}

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

using namespace std;

int main()
{
	string str[10000],mstr,lstr;
	int size=0,max=0,i,j;
	
	for(i=0;cin >> str[i];i++)
	{
		if(size<str[i].size())
			lstr=str[i];
	}
	for(j=0;j<i;j++)
	{
		int count=0;
		for(int k=j;k<i;k++)
			if(str[j]==str[k])
				count++;
		if(max<=count)
		{
			max=count;
			mstr=str[j];
		}
	}
	cout << mstr << " " << lstr << endl;
}

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

int main (void){

	string str,maxByLength("");
	//map<int,string> X; //¶Ì·³
	map<string,int> Y; //¶Ì
	//int mm;

	while (cin>>str){
		if (str.size()>maxByLength.size())	maxByLength=str;
		Y[str]++;
	}

	string maxByCount("");
	int cnt = 0;
	for(map<string, int>::iterator it = Y.begin(); it != Y.end(); ++it) {
		if(it->second > cnt) {
			maxByCount = it->first;
			cnt = it->second;
		}
	}

	cout << maxByCount << " " << maxByLength << endl;

	// cout << (*Y.rbegin()).first << " " << maxByLength << endl;
	return 0;

}

C++: #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <math.h>
#include <functional>
#include <algorithm>
#include <utility>

typedef long long Int;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
using namespace std;


map<string, int> aa;
set<string> dic;

int main(){
	string a;

	while (cin >> a){
		dic.insert(a);
		++aa[a];
	}

	int m = 0;
	string ms;

	int m2 = 0;
	string ms2;


	for (auto x : dic){
		if (m < x.length()){
			m = x.length();
			ms = x;
		}
	}

	for (auto x : aa){
		if (m2 < x.second){
			ms2 = x.first;
			m2 = x.second;
		}
	}

	cout << ms2 << " " << ms << endl;

	return 0;
}