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(){
    map<string,int>m;
    string s;
    vector<string>v;
    while(cin>>s){
        if('A'<=s[0]&&s[0]<='Z'){
            s[0]=s[0]-'A'+'a';
        }
        m[s]++;
        v.push_back(s);
    }
    int ans1=-1;
    int ans2=-1;
    string ans1s;
    string ans2s;
    for(int i=0;i<v.size();i++){
        if(ans1<m[v[i]]){
            ans1=m[v[i]];
            ans1s=v[i];
        }
        if(ans2<v[i].size()){
            ans2=v[i].size();
            ans2s=v[i];
        }
    }
    cout<<ans1s<<" "<<ans2s<<endl;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<numeric>
#include<vector>
#include<cstdio>
#include<climits>
#include<cfloat>
#include<cstring>
#define rforeach(t,p) for(t::reverse_iterator it=p.rbegin();it!=p.rend();++it)
#define all(p) p.begin(),p.end()
#define REP(i,n) for(int i=0;i<n;i++)
#define foreach(t,p,tit) for(t::iterator tit=p.begin();tit!=p.end();++tit)
using namespace std;

int main()
{
    int n=0,maxn=0,maxlen=0;
    string ss,maxs="",maxns;
    map<string,int > tango;
    map<string,int>::iterator it;
    while(cin>>ss)
    {
        if(maxlen <ss.size())
        {
            maxlen = ss.size();
            maxs = ss;
        }

        it = tango.find(ss);
        if(it==tango.end())
        {
            tango.insert(map<string,int>::value_type(ss,1));
        }
        else
        {
            n = (*it).second+ 1;
            tango.erase(it);
            tango.insert(map<string,int>::value_type(ss,n));
            maxn = max(n,maxn);
        }
    }
    for(map<string,int>::iterator it2=tango.begin();it2!=tango.end(); ++it2)
        if( (*it2).second == maxn){cout << (*it2).first; break;}

    cout << " " << maxs << endl;
    return 0;
}

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

using namespace std;

int main(){
	string word[100];
	string most, many;
	int cut[100] = {0}, num = 0, i = 0, j, k = 0, max = 0, max1 = 0;

	while(cin >> word[i]){
		bool flag = 0;

		cut[i] ++;
		if(i == 0) num = word[i].size();
		else{
			if(word[i].size() > num){
				num = word[i].size();
				most = word[i];
			}
		}
		i++;
	}

	for(i = 0; i < num; i ++){
		k = 0;
		for(j = 0; j < num; j ++){
			if(word[i] == word[j]) k ++;
		}
		if(k > max){
			max1 = i;
			max = k;
		}
	}

	cout << word[max1] << " " << most << endl;

	return 0;
}

C++: //
//  main.cpp
//  kazane
//
//  Created by h3036136 on 2017/07/27.
//  Copyright ?? 2017??´ h3036136. All rights reserved.
#include <iostream>
#include <string>
using namespace std;
int main(){
    long saidai=0;
    char f;
    int a=0,cnt=0,num=0,max=0,t;
    string str,tango[1000]={""},answer,ans;
    getline(cin,str);
    for(int i=0;i<str.size();i++){
        if(str[i]==' '){
            for(int j=a;j<i;j++){
                if(isupper(str[a])){
                    f=str[a];
                    f=f+32;
                    str[a]=f;
                }
                tango[cnt]+=str[j];
            }
            cnt=cnt+1;
            a=i+1;
        }
    }
    for(int p=a;p<str.size();p++){
        tango[cnt]+=str[p];
    }
    
    
    
    for(int k=0;k<=cnt;k++){
        if(saidai<tango[k].size()){
            saidai=tango[k].size();
            ans=tango[k];
        }
    }
    
    for(int s=0;s<cnt;s++){
        for(t=s+1;t<=cnt;t++){
            if(tango[s]==tango[t]){
                num=num+1;
            }
        }
        if(max<num){
            max=num;
            answer=tango[s];
        }
    }
    cout<<max<<" "<<saidai<<endl;
    cout<<answer<<" "<<ans<<endl;
    return 0;
}

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

using namespace std;

int main(){

	map<string,int> m;
	string str;
	string maxLength;
	while(cin>>str){
		m[str]++;
		if(maxLength.size() < str.size())
			maxLength=str;
	}
	int maxCnt=0;
	string maxString;
	for(map<string,int>::iterator it = m.begin(); it != m.end(); it++){
		if(maxCnt<it->second){
			maxCnt=it->second;
			maxString=it->first;
		}
	}
	cout<<maxString<<" "<<maxLength<<endl;

	return 0;
}

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

int main()
{
  map<string, int> fq;
  string s, ms = "";
  while (cin >> s) {
    ++fq[s];
    if (ms.size() < s.size())
      ms = s;
  }

  int cnt = 0;
  for (map<string, int>::iterator it = fq.begin(); it != fq.end(); ++it) {
    if (cnt < (*it).second) {
      s = (*it).first;
      cnt = (*it).second;
    }
  }

  cout << s << " " << ms << endl;
  return 0;
}

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

int main(){
  string str, maxlen, maxfreq;
  int freq = 0, len = 0;
  map<string, int> s;
  while(cin){
    cin >> str;
    if(s.find(str) == s.end())s[str] = 0;
    s[str]++;
    if(len < str.size()){
      len = str.size();
      maxlen = str;
    }
    if(freq < s[str]){
      freq = s[str];
      maxfreq = str;
    }
  }
  cout << maxfreq << " " << maxlen << endl;
  return 0;
}

C++: #include <iostream>
#include <cstring>
#include <cstdio> //fgets
using namespace std;

int main(){
	char str[1000];
	char word[33][33]={0};
	int longest=0;
	int check[33]={0};
	char *tmp;
	int freq=0;
	int count=0;
	int i,j;
	size_t len , prev;
	fgets(str , sizeof(str) , stdin);
		tmp=str;
		for(i=0 ; str[i]!='\0' ;i++){
			if(str[i]==' '){
				str[i]='\0';
				strcpy((char*)&word[count] , (const char*)tmp);
				tmp=str+i+1;
				count++;
			}
		}
		strcpy((char*)&word[count],(const char*)tmp);
		count++;
	for(i=0 ; i<count ; i++){
		for(j=i ; j<count ; j++){
			if(strcmp((const char*)&word[i] , (const char*)&word[j])==0){
				check[i]++;
			}
		}
	}
	for(i=0 ; i<count-1 ; i++){
		if(check[i]>check[i+1]){
			check[i]^=check[i+1];
			check[i+1]^=check[i];
			check[i]^=check[i+1];
			freq=i;
		}
	}
		prev=strlen(word[0]);
	for (i=0 ; i<count ; i++){
		len=strlen(word[i]);
		if(len > prev){
			prev = len;
			longest=i;
		}	
	}
	
	cout << (char*)&(word[freq]) << " "<< (char*)&(word[longest]) << endl;
	return 0;
}

C++: #include<stdio.h>

int main(){
char ch;
char p[101]={};
int sum;
int w,b,a;
sum=0;ch=NULL;w=0;b=0;a=0;
//scanf("%s",p);printf("%c",(p[1]));
while(scanf("%s",p)!=EOF)
{
for(int i=0;i<101;i++){

	ch=p[i];
 if(ch=='I')w=1;
else if(ch=='V')w=5;
else if(ch=='X')w=10;
else if(ch=='L')w=50;
else if(ch=='C')w=100;
else if(ch=='D')w=500;
else if(ch=='M')w=1000;
switch(w){
case 1:
a=1;break;
case 5:
	if(b==1){a=3;break;}
else  if(b!=1)a=5;break;
case 10:
if(b==1){a=8;break;}
else  if(b!=1)a=10;break;
case 50:
if(b==10){a=30;break;}
else  if(b!=10)a=50;break;
case 100:
if(b==10){a=80;break;}
else  if(b!=10)a=100;break;
case 500:
if(b==100){a=300;break;}
else  if(b!=100)a=500;break;
case 1000:
if(b==100){a=800;break;}
else  if(b!=100)a=1000;break;
}

sum+=a;b=a;
ch='\0';w=0;a=0;
}
printf( "%d\n",sum);
sum=0;ch='\0';w=0;b=0;a=0;
for(int i=0;i<101;i++)
	p[i]='\0';


}

return 0;
}