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 <cstdio>
#include <cstring>

using namespace std;

int main(void){
	char buf[1000][33], word[33];
	int bufnum = 0, same[1000], i, smax, lmax;
	memset(same,0,sizeof(same));
	while(scanf("%s",word) != EOF){
		for(i = 0;i < bufnum;i++){
			if(!strcmp(word,buf[i])){
				same[i]++;
				break;
			}
		}
		if(bufnum == i){
			strcpy(buf[bufnum],word);
			same[bufnum++]++;
		}
	}
	smax = 0, lmax = 0;
	for(i = 0;i < bufnum;i++){
		if(smax < same[i]){
			smax = same[i];
		}
		if(lmax < strlen(buf[i])){
			lmax = strlen(buf[i]);
		}
	}
	for(i = 0;i < bufnum;i++){
		if(smax == same[i])
			printf("%s ",buf[i]);
	}
	int cnt1 = 0, cnt2 = 0;
	for(i = 0;i < bufnum;i++){
		if(lmax == strlen(buf[i]))
			cnt1++;
	}
	for(i = 0;i < bufnum;i++){
		if(lmax == strlen(buf[i])){
			printf("%s",buf[i]);
			cnt2++;
			if(cnt1 != cnt2){
				printf(" ");
			}
		}
	}
	return 0;
}

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

using namespace std;

int main(){
	char num[100], damy[100], damy2[100];
	char now;
	string ans;
	int n, i, j, lng, cut = 0, l_damy;
	while(1){

		cin >> n;
		if(n == 0) break;
		cin >> num;


		for(i = 0; i < n; i ++){
			lng = strlen(num);
			now = num[0];
			for(j = 0; j < lng; j++){
				if(now == num[j]){
					cut ++;
					now = num[j];
				}
				else{
				}
			}

			ans = damy;
			l_damy = strlen(damy);
			for(j = 0; j < l_damy; j ++){
				num[j] = damy[j];
			}
		}
		cout << ans << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<string.h>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
int main()
{
    map<string,int> m;
    string s;
    getline(cin,s);
    string tem="";
    for(int i=0;i<s.length();i++){
        if(s[i]!=' ')
            tem+=s[i];
        else{
            if(m.find(tem)!=m.end()){
                (m.find(tem))->second++;
            }
            else{
                m.insert(pair<string,int>(tem,1));
            }
        }
    }
    string most,longest;
    map<string,int>::iterator it = m.begin();
    int mo=0;
    for(;it!=m.end();it++){
        if(it->first.length()>longest.length())
            longest=it->first;
        if(it->second>mo){
            most=it->first;
            mo=it->second;
        }
    }
    cout<<mo<<endl<<longest<<endl;
    return 0;
}

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

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int const MOD = 1000000007;

int main() {
    string s;
    multiset<string> v;

    int max_num = 0;
    int max_len = 0;

    while(cin >> s) {
        v.insert(s);
        max_num = max((int)v.count(s), max_num);
        max_len = max((int)s.length(), max_len);
    }

    for(auto x : v) {
        if(v.count(x) == max_num) cout << x << endl;
    }
    for(auto x : v) {
        if(x.length() == max_len) cout << x << endl;
    }
    return 0;
}

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

int main(){
  int m=0,f=0;
  multiset<string> a;
  string s,ms,mf;
  while(cin>>s){
    a.insert(s);
    if(m<s.size())ms=s;m=s.size();
    if(f<a.count(s))mf=s;f=a.count(s);
  }
  //cout<<f<<" "<<m;////////
  cout<<mf<<" "<<ms<<endl;
  return 0;
}

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

using namespace std;

int main(void){
	string s;
	int length=0,max=0;
	map<string,int> sen;
	vector<string> w;
	while(cin >>s){
		w.push_back(s);
		if(sen.find(s)!=sen.end()){
			sen[s]++;
		}else{
			sen.insert( pair<string, int>(s,1));
		}
	}
	map<string,int>::iterator p;
	for(p = sen.begin() ; p !=sen.end() ; p++){
		if( max < p->second) max = p->second;
	}
	for(p = sen.begin() ; p !=sen.end() ; p++){
		if( max == p->second){
			cout << p->first << " ";
			break;
		}
	}
	for(int i=0 ; i<w.size() ; i++){
		if( length < w[i].size() ) length = w[i].size();
	}
	for(int i=0 ; i<w.size() ; i++){
		if( length==w[i].size() ){
			cout << w[i] << endl;
			break;
		}
	}
    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 = 1, max_str = 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)
					max_length = (int)tmp.size();
				break;
			}
		}
		if (i >= max) {
			str[i-1] = tmp;
			max++;
			a[i - 1]++;
			if (max_str < a[i-1]) {
				max_str = a[i - 1];
				max_num = i - 1;
			}
			if (tmp.size() > max_length)
				max_length = (int)tmp.size();
		}
	}
	cout << str[max_num] << endl;

	for (i = 0; i < max; i++) {
		if ((int)str[i].size() == max_length)
			cout << str[i] << endl;
	}
	return 0;
}

C++: #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[j])){
                    f=str[j];
                    f=f+32;
                    str[j]=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=1;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[t];
        }
    }
    cout<<answer<<" "<<ans<<endl;
    return 0;
}

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

using namespace std;

int main() {
	string str;
	map<string, int> m;
	string pop_s, len_s;
	int pop=0, len=0;
	while (cin >> str) {
		m[str]++;
		if (m[str]>pop) {
			pop = m[str];
			pop_s = str;
		}
		if (str.length()>len) {
			len = str.length();
			len_s = str;
		}
	}
	cout << pop_s << " " << len_s << endl;
}

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

int main() {
	ios :: sync_with_stdio(false);
	map <string, int> mp;
	for(string s; cin >> s; )
		mp[s] ++;
	string f = "", l = "";
	for(auto p : mp) {
		string s = p.first;
		if(mp[s] > mp[f])
			f = s;
		if(s.size() > l.size())
			l = s;
	}
	cout << f << ' ' << l << '\n';
	return 0;
}