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 <stdio.h>
#include <string.h>
#include <ctype.h>
int main(){
    int n=0,i,cnt[100]={0},j=0,max=0,longer=0,cou[100]={0};
    char str,save[100][100];
    while(1){
        scanf("%c",&str);
        if(str=='\n') break;
        if(str!=' '){
            if(isupper(str)) {
                str = tolower(str);
            }
            save[j][n]=str;
            n++;
            cou[j]++;
        }else{
            for(i=0;i<j;i++){
                if(strcmp(save[i],save[j])){
                    cnt[i]++;
                }
            }
            j++;
            n = 0;
        }
    }
    cnt[0]--;
    for(i=0;i<=j+1;i++){
        if(cnt[max]<=cnt[i]) max=i;
    }
    for(i=1;i<=j+1;i++){
        if(cou[longer]<=cou[i]){
            longer=i;
        }
    }
    printf("%s %s\n",save[max],save[longer]);

    return 0;
}

C++: #include <iostream>
#include <map>
#include <string>
 
int main(void){
    using namespace std;
    
    map<string, int> sentence;
    string maxFrequentSentence="";
    string maxCharacterSentence="";
    string inputSentence;
     
    /* Input */
    while( cin >> inputSentence )
    {
        /* CountUp Sentence*/
        if( sentence.count(inputSentence) != 0 )
        {
            sentence[inputSentence] = sentence[inputSentence] + 1;
        }
        else
        {
            sentence[inputSentence] = 1;
        }
         
        /* Update Max Characters Sentence */
        if( maxCharacterSentence.size() < inputSentence.size() )
        {
            maxCharacterSentence = inputSentence;
        }
         
        /* Update Max Frequent Sentence */
        if( sentence[maxFrequentSentence] < sentence[inputSentence] )
        {
            maxFrequentSentence = inputSentence;
        }
    }
     
    /* Output */
    cout << maxFrequentSentence << " " << maxCharacterSentence << endl;
  
    return 0;
}

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

int main(){
    string str[1001],tmp;
    int max_num = 0,max_length=0,i,max = 0,max_str = 0,length = 0,a[1001] = {};
    
    while(cin>>tmp){
        for(i = 0;i < tmp.size();i++){
            if('A' <= tmp[i] && tmp[i] <= 'Z')
                tmp[i] = tmp[i] + 'a' - 'A';
        }
        
        for(i = 0;i < max;i++){
            if(str[i] == tmp){
                a[i]++;
                if(max_str < a[i]){
                    max_str = a[i];
                    max_num = i;
                }
                if(tmp.size() > max_length)
                    length = (int)tmp.size();
                    
            }
        }
        if(i >= max){
            str[i] = tmp;
        }
    }
    cout<<str[max_num]<<endl;
    
    for(i = 0;i < max;i++){
        if((int)str[i].size() == length)
            cout<<str[i]<<endl;
    }
    return 0;
}

C++: // J4180449 三宅亮輔
// 問題名
// -
// 問題URL
// -
// 所要時間
// -
// 学んだこと
//
//
//

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

map<string, int> m;
string max_str, len_str;
int max_val, max_len;

string str;
int main() {
    while(cin >> str) {
        m[str] += 1;
    }
    for(auto itr = m.begin(); itr != m.end(); itr++) {
        if(itr->second > max_val) {
            max_val = itr->second;
            max_str = itr->first;
        }
        if(itr->first.length() > max_len) {
            max_len = itr->first.length();
            len_str = itr->first;
        }
    }
    cout << max_str << " " << len_str << endl;
}