Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

type Pair struct {
	key   string
	value int
}

func main() {
	scanner.Split(bufio.ScanWords)
	counts := map[string]int{}
	maxLen := 0
	maxLenWord := ""
	for {
		word := nextString()
		if word == "" {
			break
		}

		counts[word]++

		if len(word) > maxLen {
			maxLen = len(word)
			maxLenWord = word
		}
	}

	mapPairs := []Pair{}
	for k, v := range counts {
		mapPairs = append(mapPairs, Pair{k, v})
	}
	sort.Slice(mapPairs, func(i, j int) bool { return mapPairs[i].value > mapPairs[j].value })

	fmt.Println(mapPairs[0].key, maxLenWord)
}

Python: from collections import defaultdict
d = defaultdict(int)
w = ['']*32
for s in input().split():
    d[s] += 1
    w[len(s)-1] = s
l = sorted(((k, v) for k, v in d.items()), key=lambda x: -x[1])
print(l[0][0], next(s for s in w[::-1] if s))

Python: from collections import Counter    
s = raw_input()
c = Counter(s.split())
maxone = sorted(s.split(),key=lambda x:len(x))[-1]
print("{0} {1}".format(c.most_common()[0][0],maxone))

Python: a=str(raw_input()).split(" ")
b=set(a)
c,d=[0,""],""
for i in b:
    if len(i)>len(d): d=i
    if a.count(i)>c[0]:
        c[1]=i
        c[0]=a.count(i)
print(c[1]+" "+d)

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: s = list(input().split())
maxLen = 0
maxNum = 0
dic = {}
for word in s:
    if not (word in dic):
        dic[word] = 1
    else:
        dic[word] += 1
    if maxNum < dic[word]:
        maxNum = dic[word]
        ansNum = word
    if maxLen < len(word):
        maxLen = len(word)
        ansLen = word
print(ansNum, ansLen)

Python: s = raw_input()
c = Counter(s.split())
maxone = sorted(s.split(),key=lambda x:len(x))[-1]
print("{0} {1}".format(c.most_common()[0][0],maxone))

Python: words = input().split()
word2count={}
maxlength = 0
maxlengthword=None
for word in words:
    word2count[word] = word2count.get(word, 0) + 1
    if maxlength < len(word):
        maxlength = len(word)
        maxlengthword = word

print(sorted(word2count.items(), key=lambda x: -1*x[1])[0][0],maxlengthword)

Python: st = input().split()
a = ""
b = {} 
for s in st:
    if len(s) > len(a): a = s
    b[s] = b.get(s, 0) + 1
ls = sorted(b, key=b.get)[-1]
print(ls, a)

Python: words = input().split(' ')
print(sorted(words, key=words.count)[-1], sorted(words, key=len)[-1])

Python: import sys
dic = {}
txt = sys.stdin.read().strip().split()
for t in txt:
    if t in dic:
        dic[t] += 1
    else:
        dic[t] = 1
s = sorted(dic.items(),key=lambda x:x[1],reverse=1)
fre = s[0][0]
t = sorted(dic.items(),key=lambda x:len(x[0]),reverse=1)
longest = t[0][0]
print("%s %s" % (fre,longest))

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

Python: def main():
    s = input().split()
    ss = sorted(set(s), key = s.index)
    cnt = []
    ans = []

    for x in ss:
        c = 0
        for y in s:
            if x == y:
                c += 1
            else:
                pass
        else:
            cnt.append(c)

    cntcnt = sorted(cnt, reverse = True)
    hoge = cntcnt.count(cntcnt[0])

    for x in range(hoge):
        ans.append(ss[cnt.index(cntcnt[x])])


    lenc = []
    for x in range(len(ss)):
        lenc.append(len(ss[x]))

    lenclenc = sorted(lenc, reverse = True)
    fuga = lenclenc.count(lenclenc[0])

    for x in range(fuga):
        ans.append(ss[lenc.index(lenclenc[x])])

    for x in range(len(ans)):
        if x != len(ans) - 1:
            print(ans[x], end = " ")
        else:
            print(ans[x])


if __name__ == "__main__":
    main()

Python: text = input().split()
l = {}
dc = {}

for i in text:
    l[i] = len(i)
    if i in dc.keys():
        dc[i] += 1
    else:
        dc[i] = 0


print(max(dc, key=dc.get), max(l, key=l.get))

Python: li = input().split()
m = (li[0], 0)
l = (li[0], len(li[0]))
for s in set(li):
    if li.count(s) > m[1]: m = (s, li.count(s))
    if l[1] < len(s): l = (s, len(s))
print(m[0], l[0])

Python: import collections
n=input().split()
c=collections.Counter(n)
dic={i: len(i) for i in n}
print(c.most_common()[0][0],max(dic,key=dic.get))

Python: text = input().split()
dic = dict(zip(text,[0 for i in range(len(text))]))
for i in text:
	dic[i] = dic[i] + 1
max_ = max(dic.values())
for key,value in dic.items():
	if value == max_:
		most = key
max_ = 0
for i in dic.keys():
	if len(i) > max_:
		max_ = len(i)
		amax_ = i
print(most, amax_)

Python: s = input().split()

len_max = 0
freq_max = 0
w_len = ""
w_freq = ""
dict_freq = {}

for i,w in enumerate(s):
    if w in dict_freq:
        dict_freq[w] += 1
    else:
        dict_freq[w] = 1
    if len(w) > len_max:
        w_len = w
        len_max = len(w)
    if dict_freq[w] > freq_max:
        w_freq = w
        freq_max = dict_freq[w]
print(w_freq, w_len)

Python: from collections import Counter
s=input()
s=s.lower()

s=s.split(" ")
long=sorted(s,key=lambda w:len(w),reverse=True)

freq=dict(Counter(s)).items()
freq=sorted(freq,key=lambda w:w[1],reverse=True)

print(freq[0][0],long[0])

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

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

Python: s = list(input().split())
a = [s.count(i) for i in s]
l = [len(i) for i in s]
print(s[a.index(max(a))], s[l.index(max(l))])

Python: x=input()
A=x.split()
S=[]
L=[]
for i in A:
    s=A.count(i)
    S.append(s)
    l=len(i)
    L.append(l)
M=max(S)
m=max(L)
Y=S.index(M)
y=L.index(m)
print(A[Y],A[y])

Python: s=list(map(str,input().split()))

m={}
l={}

for i in range(len(s)):
    t=s[i].lower()
    if t in m:
        m[t]+=1
    else:
        m.setdefault(t,1)
    
    if t in l:
        pass
    else:
        l.setdefault(t,len(t))


print(max(m,key=m.get),max(l,key=l.get))

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

Python: n=list(map(str,input().split()))
s=0
t=0
p=[]
q=[]
for i in range(0,len(n)):
    d=n.count(n[i])
    if d>s:
        p.append(n[i])
        s=d
    else:
        pass
    if len(n[i])>t:
        q.append(n[i])
        t=len(n[i])
p=p[::-1]
q=q[::-1]
print(p[0],q[0])

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().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: text = input().split()
print(max(text), max(text, key=len))

Python: s = list(input().split())
maxLen = 0
maxNum = 0
dic = {}
for word in s:
    if not (word in dic):
        dic[word] = 1
    else:
        dic[word] += 1
    if maxNum < dic[word]:
        maxNum = dic[word]
        ansNum = word
    if maxLen < len(word):
        maxLen = len(word)
        ansLen = word
print(ansNum, ansLen)
print(dic)

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

Python: import statistics
sentLong = ''
sent = list(map(str,input().split(' ')))
for i in range(len(sent)):
	if len(sentLong) < len(sent[i]):
		sentLong = sent[i]
print(statistics.mode(sent), sentLong)