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<cstring>
#include<algorithm>
using namespace std;

struct Inf
{
      char save[35];
}inf[1100];

bool cmp(struct Inf a,struct Inf b)
{
      return strcmp(a.save,b.save)<0;
}
int main()
{
      int num=0,maxn=0,flag2;
      char ans2[38],last[39];

      while(cin>>inf[num].save)
      {
           
            int len=strlen(inf[num].save);

            if(len>maxn)
            {
                  maxn=len;
                  flag2=num;
            }
            num++;
      }
      strcpy(ans2,inf[flag2].save);
      sort(inf,inf+num,cmp);

      int sum=1;
      flag2=0;
      int Max=1;
      strcpy(last,inf[0].save);
     
      for(int i=1;i<num;i++)
      {
            if(strcmp(inf[i].save,last)==0)
                  sum++;
            else
            {
                  if(sum>Max)
                  {
                        Max=sum;
                        flag2=i-1;
                  }
                  sum=1;

            }
            strcpy(last,inf[i].save);
      }

      if(sum>Max)
         flag2=num-1;



     cout<<inf[flag2].save<<" "<<ans2;


      return 0;
}

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