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

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

Python: s = raw_input().split()
maxLength = 0
word1 = ""
word2 = ""
count = {}
maxCount = 0
for i in range(len(s)):
    count[s[i]] = 0
for i in range(len(s)):
    count[s[i]] += 1
    if(len(s[i]) > maxLength):
        maxLength = len(s[i])
        word2 = s[i]
for i in range(len(s)):
    if(count[s[i]] > maxCount):
        maxCount = count[s[i]]
        word1 = s[i]
print(word1),
print(word2)

Python: # coding: utf-8
# Here your code !

l = input().split()

len_m = 0
for e in l:
    if len_m < len(e):
        len_m = len(e)
        a1 = e
    
d = {}

for e in l:
    if e not in d:
        d.update({
            e: 1
        })
    else:
        t = d[e]
        d.update({
            e: (t+1)
        })
print('%s %s' % (max(d.items(), key=lambda x: x[1])[0],a1))

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

Python: if __name__ == '__main__':
    maxL = 0
    maxF = 0
    strlst = list(map(str, input().split()))
    for s in strlst:
        if strlst.count(s) > maxF:
            maxF = strlst.count(s)
            maxFans = s
        if len(s) > maxL:
            maxL = len(s)
            maxLans = s
    print(maxFans, maxLans)

Python: from collections import Counter

lst = input().split()

dic = Counter(lst)
most_common = dic.most_common(1)[0][0]

length = max([len(s) for s in lst])

for s in lst:
  if len(s) == length:
    longest = s

print(most_common, longest)

Python: s = input().split()
max_c = 0
max_l = 0
c = ''
l = ''
for i in s:
  if s.count(i) > max_c:
    max_c = s.count(i)
    c = i
  if len(i) > max_l:
    max_l = len(i)
    l = i
print(c+' '+l)

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

Python: dic = {}
max = 0
maxword = 0
word = input().strip().split(" ")
i = 1
while i <= len(word):
    if word[i-1] in dic:
        dic[word[i-1]] += 1
    else:
        dic[word[i-1]] = 1
    i += 1
for k,v in sorted(dic.items()):
    if v > max:
        max = v
        words = k
for k in dic:
    if len(k) > maxword:
        maxword = len(k)
        maxwords = k
print(words + " " + maxwords)

Python: from __future__ import (absolute_import, division, print_function,
                        unicode_literals)
from sys import stdin
from collections import Counter

counter = Counter()
for line in stdin:
    for s in line.split():
        counter[s] += 1
print(counter.most_common()[0][0], sorted(counter.keys(), key=len)[-1])

Python: 
a = input().split()

print(max(a,key=a.count),max(a,key=len))

Python: d = {}
l = ''
s = input()
for i in s.split():
    if not i in d:
        d[i] = 0
    else:
        d[i] += 1
    if len(str(l)) < len(str(i)):
        l = i

print(sorted(d.items(), key=lambda x: x[1])[-1][0], l)

Python: import sys
from collections import Counter

if __name__ == '__main__':
    # ??????????????\???
    # line = 'Thank you for your mail and your lectures'
    data = []
    for line in sys.stdin:
        data = line.strip().strip('.').lower().split(' ')

    # print(data)

    # ??????????¢??????????
    c = Counter(data)  # ????????????????¢????
    most_frequent_word = c.most_common(1)[0][0]
    # ???????????????????????¢???
    max_length_word = ''
    for w, freq in c.most_common():
        if len(w) > len(max_length_word):
            max_length_word = w

    # ???????????¨???
    print('{0} {1}'.format(most_frequent_word, max_length_word))

Python: dic = dict()
maxWords = ""
words = list(x for x in input().split())

for w in words:
    if len(w) > len(maxWords):
        maxWords = w
    value = dic.get(w)
    if not value:
        dic.setdefault(w,1)
    else:
        dic.update({w:value + 1})
dic = dict(sorted(dic.items(), key=lambda x: x[1],reverse=True))
print(list(dic.keys())[0],maxWords)

Python: l = input().split()
#print(l.count("your"))
hindo_max = 0
len_max = 0
for word in l:
	if hindo_max < l.count(word):
		hindo_max = l.count(word)
		hindo_word = word
	if len_max < len(word):
		len_max = len(word)
		len_word = word
print(hindo_word, len_word)

Python: ns=list(map(str,input().split()))
mp={}
for n in ns:
	if n in mp:
		mp[n]=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):
		long_word=k
		max_len=len(k)
	if max_fre<v:
		freq_word=k
		max_fre=v
print(freq_word,long_word)

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

Python: s=input().split()

moji=[]
count=[]
mojisuu=""

for i in range(len(s)):
    n=0
    if(len(mojisuu)<len(s[i])):
        mojisuu=s[i]
    
    for j in range(len(moji)):
        if(moji[j]==s[i]):
            count[j]+=1
            n+=1
            break
    if(n==0):
        moji.append(s[i])
        count.append(1)

max_count=max(count)
max_index=count.index(max_count)
shutugen=moji[max_index]

print(shutugen, mojisuu)

Python: from collections import Counter
sentence = input().split()
cnt = Counter(sentence)
print(cnt.most_common(1)[0][0], max(sentence, key=lambda x: len(x)))

Python: # coding: utf-8
# Here your code !

l = input().split()

len_m = 0
for e in l:
    if len_m < len(e):
        len_m = len(e)
        a1 = e
    
d = {}

for e in l:
    if e not in d:
        d.update({
            e: 1
        })
    else:
        t = d[e]
        d.update({
            e: (t+1)
        })
print('%s %s' % (max(d),a1))

Python: from collections import Counter

def process(line):
   longest = sorted(line, key=len)
   c = Counter(line)
   count = c.most_common(1)
   return count[0][0], longest[-1]

line = input().split()
a, b = process(line)
print('{} {}'.format(a, b))

Python: from collections import Counter 
word = list(input().split())
count = Counter(word)
x,y = 0,0
for i in word:
    if x<len(i):
        x=len(i)
        y=i
print(count.most_common()[0][0],y)

Python: import collections

d = input()
D = d.split()

c = collections.Counter(D)

print(c.most_common()[0][0], max(D,key=len))

Python: import statistics as st
word1 = []
word = raw_input().split()
for i in xrange(len(word)):
	word1.append(len(word[i]))
for i in xrange(len(word)):
	if len(word[i]) == max(word1):
		print(st.mode(word), word[i])
		break

Python: # ライブラリのインポート
#import re #正規表現
import sys
#import heapq
#import collections
#import math

def main():
    y = ""
    for x in sys.stdin: y += x
    a = list(y.strip("\n").split(" "))
    print(max(a, key=a.count), max(a, key=len))
    
if __name__ == '__main__':
    main()

Python: # 0029
words = input().split()
print(max(words, key=words.count), max(words, key=len))

Python: s=input().split()
dict={}
max=""
max_num=0
max_index=""
for i in s:
    if i in dict:
        dict[i]+=1
        if max_num<dict[i]:
            max_index=i
            max_num=dict[i]
    else: dict[i]=0
    if len(i)>len(max):
        max=i
print(max_index,max)

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