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

Python: L=[]
M=[]
A=list(map(str,input().split()))
B=len(A)

for i in range(B):
    C=A.count(A[i])
    L.append(C)
D=max(L)
E=L.index(D)
print(A[E],end=" ")

for j in range(B):
    F=len(A[j])
    M.append(F)
G=max(M)
H=M.index(G)
print(A[H])

Python: import sys 

def main():
    
    input_line = []
#     with open('test_data') as f:
#         for line in f.readline().split():
#             input_line.append(line)
            
    for line in sys.stdin.readline().split():
        input_line.append(line)
    #print(input_line)
   
    number_len = {}
    number_fre = {}
    for i in input_line: 
        number_len.update({i:len(i)})
        number_fre.update({i:input_line.count(i)})
        
    sorted_x = sorted(number_len.items(), key=operator.itemgetter(1))
    sorted_y = sorted(number_fre.items(), key=operator.itemgetter(1))
    print(sorted_x[-1][0],sorted_y[-1][0])


        
if __name__ == '__main__':
    main()

Python: # AOJ 0029 English Sentence
# Python3 2018.6.12 bal4u

import collections
from operator import itemgetter

a = list(input().split())
maxlen = 0
for i in a:
	if len(i) > maxlen:
		maxlen = len(i)
		ans_max_len = i

dict = collections.Counter(a)
print(max(dict.most_common(), key=itemgetter(1))[0], ans_max_len)

Python: from collections import Counter
def main():
    str = Counter(input().split(" "))
    long_str = ""
    for word in str:
        if len(long_str) < len(word):
            long_str = word
    print(str.most_common(1)[0][0] , long_str)


if __name__ == '__main__':
    main()

Python: # Aizu Problem 0029: English Sentence
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


L_max = 0
counts = {}
for word in input().split():
    if len(word) > L_max:
        L_max = len(word)
        long_word = word
    counts[word] = counts.get(word, 0) + 1
    
for a in sorted([a for a in counts if counts[a] == max(counts.values())]):
    print(a, long_word)

Python: s=input().split()
print(max(s,key=s.count),max(s,key=len))

Python: from collections import defaultdict as dd
a=dd(int)
leng=""
seq=""
for i in input().split():
    a[i]+=1
    if a[seq]<a[i]:
        seq=i
    if len(leng)<len(i):
        leng=i
print(seq,leng)

Python: a = input()
a = a.split(' ')
b=[]
e=[]
for i in range(len(a)):
    b.append(len(a[i]))
    f=a.count(a[i])
    e.append(f)
c=a[b.index(max(b))]
g=a[e.index(max(e))]

print(g,c)

Python: A=list(input().split())
L=len(A)
MAX1=0
MAX2=0
for i in range(L):
    s=A.count(A[i])
    if s>MAX1:
        MAX1=s
        x=A[i]
    else:
        pass
    
    l=len(A[i])
    if l>MAX2:
        MAX2=l
        y=A[i]
    else:
        pass
    
print(x,y)

Python: sentence = input().split()
longest = sentence[0]
dictionary = {}
for word in sentence:
    if word in dictionary:
        dictionary[word] += 1
    else:
        dictionary[word] = 0
    if len(word) > len(longest):
        longest = word
mode_value = 0
mode_key = 0
for word in dictionary:
    if mode_value < dictionary[word]:
        mode_value = dictionary[word]
        mode_key = word
print(mode_key, longest)

Python: import statistics
m = list(map(str,input().split()));
mode = statistics.mode(m)
a = "";
for i in range(0,len(m)):
    if len(a) < len(m[i]):
        a = m[i];
print(mode,a);

Python: sentence = list(input().split())

maxcount = 0
maxlen = 0
cs = ''
ls = ''

for i in sentence:
    if maxcount < sentence.count(i):
        maxcount = sentence.count(i)
        cs = i

    if maxlen < len(i):
        maxlen = len(i)
        ls = i

print(cs, ls)

Python: s=input().split()
print(max(s,key=s.count),max(s,key=len))

Python: from collections import Counter
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def solve():
    s = readline()
    c = Counter(s.split())
    write("%s %s\n" % (max(c, key=lambda x: c[x]), max(c, key=len)))
solve()

Python: ns=list(map(str,input().split()))
mp={}
for n in ns:
    if n in mp:
        mp[n] +=1
    else:
        mp[n]=1
long_word=""
freq_word=""
max_len=0
max_fre=0
for k,v in mp.items():
    if max_len<len(k):
        max_len=len(k)
        long_word=k
    if max_fre<v:
        max_fre=v
        fre_word=k
print(fre_word, long_word)

Python: from collections import Counter
s = input().split()
po = Counter(s)
s.sort(reverse=True,key=lambda x:len(x))

print(po.most_common()[0][0],s[0])

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

using namespace std;

int main(void)
{
	string longest;
	string in;
	pair<string, int> times;
	map<string, int> mp;
	
	while(std::cin >> in){
		if(longest.size() < in.size()) longest = in;
		mp[in]++;
	}
	
	std::map<string, int>::iterator mp_first = mp.begin();
	for(;mp_first != mp.end(); ++mp_first){
		if(times.second < (mp_first -> second))
		times = *mp_first;
	}
	
	cout << times.first << ' ' << longest << endl;
	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define PI 3.14159265358979323846
#define vll vector<long long>
using namespace std;
using ll = long long;
using ld = long double;

// ----本問について----
// 問題：英語の文章
// 問題文URL：https://onlinejudge.u-aizu.ac.jp/problems/0029
// 所要時間：
// 学んだこと：
// ------------------

// ----ここから本問のソースコード----

// グローバル変数（入力）
unordered_map<string, ll> m;

void solve() {
  string s;
  ll maxL = 0;
  string maxS;
  while (cin >> s) {
    m[s]++;
    if ((ll)s.size() > maxL) {
      maxL = s.size();
      maxS = s;
    }
  }
  ll maxH = 0;
  string maxHS;
  for (auto itr = m.begin(); itr != m.end(); itr++) {
    string key = itr->first;
    ll value = itr->second;
    if (value > maxH) {
      maxH = value;
      maxHS = key;
    }
  }
  cout << maxHS << " " << maxS << endl;
}

int main() {
  solve();
  return 0;
}

C++: #include <bits/stdc++.h>
 
using namespace std;
 
/*-------------------------------*/
#define FOR(i, a, b) for(int i = (a); i < (b); i++) 
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; i--)
#define all(i) (i).begin(),(i).end()
#define pb push_back
#define mp make_pair 
 
typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<long long> llv;
typedef vector<pint> vpint;
typedef vector<string> vs;
/*-------------------------------*/
 
int main(void)
{
  vs s;
  string a, smax;
  cin >> smax;
  while (cin >> a){
    if (a.size() > smax.size()) smax = a;
    s.pb(a);
  }

  string x = s[0];
  int bcnt = 0;
  FOR(i, 0, s.size()){
    int cnt = 0;
    FOR(j, 0, s.size()){
      if (s[i] == s[j]) cnt++;
    }
    if (i == 0) bcnt = cnt;
    if (bcnt < cnt) x = s[i];
    bcnt = cnt;
  }
  cout << x << " " << smax;

  return 0;
}