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: def solve():
    text = input()
    longest, length = '', 0
    dic = {}
    for word in text.split():
        if word in dic.keys():
            dic[word] += 1
        else:
            dic[word] = 1
        
        if length < len(word):
            longest = word
            length = len(word)
    
    target, cnt = '', 0
    for k, v in dic.items():
        if v > cnt:
            target = k
            cnt = v
    print(target, longest)

if __name__ == "__main__":
    solve()

Python: word = sorted(input().split())
length = len(word)
cnt = 0
cc = ""
w = ""
wc = 0
for i in word:
    if cnt < len(i):
        cnt = len(i)
        cc = i
for i in range(length):
    if word.count(word[i]) > wc:
        wc = word.count(word[i])
        w = word[i]
print(w, cc)

Python: import sys 
def main():
    input_line = []
    test_line = 'Thank you for your mail and your lectures'
    
#     for line in test_line.split():
#         input_line.append(line)
        
    

    for line in sys.stdin:
        input_line.append(line.split())
    
    #print(input_line.count('your'))
    number_len = {}
    number_fre = {}
    for i in input_line: 
        number_len.update({i:len(i)})
        number_fre.update({i:test_line.count(i)})
        



        
if __name__ == '__main__':
    main()

Python: x=input().split()
longestWord= ""
mostWord=0
currentCount=0
THEmostWord=""

for r in range (len(x)):
    if len(x[r])> len(longestWord):
        longestWord=x[r]

for j in range (len(x)):
    currentCount=x.count(x[j])
    if currentCount > mostWord:
        mostWord= currentCount
        THEmostWord=x[j]

print(THEmostWord, longestWord)

Python: from collections import Counter
text = input().split()
tmp = ""
for t in text:
    if len(t) > len(tmp):
        tmp = t
print(Counter(text).most_common()[0][0], tmp)

Python: # AOJ 0029 English Sentence
# Python3 2018.6.12 bal4u

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

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

frq = ""
mx = ""
for i in S:
    if S.count(i) > S.count(frq):
        frq = i
    if len(i) > len(mx):
        mx = i

print(frq,mx)

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
    else: dict[i]=0
    if len(i)>len(max):
        max=i
print(max_index,max)

Python: # -*- coding: utf-8 -*-
from collections import defaultdict

d = defaultdict(int)
_input = input()

for word in _input.split():
    d[word] += 1

times = sorted(d.items(), key=lambda item: item[1], reverse=True)
lengths = sorted(d.items(), key=lambda item: len(item[0]), reverse=True)

print(times[0][0], end=' ')
print(lengths[0][0])

Python: S = input().split()
words = []
for i in range(len(S)):
    words.append(S[i])
    words.sort()

cnt = 0
maxcnt = 0
ans1 = ""
ans2 = words[0]
for i in range(1, len(words)):
    if words[i] == words[i-1]:
        cnt += 1
    else:
        cnt = 0
    if maxcnt < cnt:
        ans1 = words[i]
        maxcnt = cnt
    if len(ans2) < len(words[i]):
        ans2 = words[i]

print(ans1,ans2)

Python: targ = input().split(' ')
mostfre = {}
ansfre = ""
longest = [0,""]
for t in targ:
    if len(t) > longest[0]:
        longest[0],longest[1] = len(t),t
    mostfre[t] = mostfre.get(t,0) + 1
temp = 0
print(mostfre)
for k,v in mostfre.items():
    if v > temp:
        temp = v
        ansfre = k
print(ansfre + ' ' + longest[1])

Python: from collections import Counter
max_len = None
l = 0
counter = Counter(input().split())
for ci in counter:
    if l < len(ci):
        max_len = ci
        l = len(ci)

print(counter.most_common(1)[0][0], max_len)

Python: from collections import Counter
a = input().split()
long = ""
for w in a:
    if len(w) > len(long):
        long = w
counter = Counter(a)
for word, cnt in counter.most_common():
    print(word, long)
    break

Python: # -*- coding: utf-8 -*-
from collections import defaultdict

d = defaultdict(int)
_input = input()
sentence = [e for e in _input.split()]
l = []

for word in sentence:
    d[word] += 1

times = sorted(d.items(), key=lambda item: item[1], reverse=True)
lengths = sorted(d.items(), key=lambda item: len(item[0]), reverse=True)

print(times[0][1], end=' ')
print(lengths[0][0])

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)
   



        
if __name__ == '__main__':
    main()

Python: a=input().split()
d,e={},{}
for w in a:d.setdefault(w,0);d[w]+=1
for w in d:
 if d[w]==max(d.values()):print(w,end='')
 e.setdefault(len(w),[]).append(w)
print('',*e[max(e)])

Python: #標準入力
line = list(input().split())

#max関数を使いkeyを引数に設定し、最瀕の単語と、文字数の長い単語を出力する
print(max(line,key = line.count),max(line,key = len))

Python: n = input().split()
a=0
b=0
l="x"
m="x"
for i in range(len(n)):
    if n.count(n[i])>a:
        a=n.count(n[i])
        l=n[i]
for i in range(len(n)):
    if len(n[i])>b:
        b=len(n[i])
        m=n[i]
print(l,m)

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

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

Python: # coding: utf-8
# Your code here!

import collections
s = input()
counter = collections.Counter(s.split())
d = counter.most_common()
#print(d)

maxm = 0
maxn = 0
for i in range(len(d)):
   if d[i][1] > maxm:
      maxm = d[i][1]
   if len(d[i][0]) > maxn:
      maxn = len(d[i][0])

#print(maxm, maxn)

for i in range(len(d)):
   if d[i][1] == maxm:
      print(d[i][0], end = "")
   if len(d[i][0]) == maxn:
      print("", d[i][0])

Python: x=input().split()
longestWord= ""
mostWord=0
currentCount=0
THEmostWord=""


for r in range (len(x)):
    if len(x[r])> len(longestWord):
        longestWord=x[r]

for j in range (len(x)):
    thing= x[j]
    currentCount=x.count(thing)
    if currentCount > mostWord:
        mostWord= currentCount
        THEmostWord=thing
        


print(THEmostWord, longestWord)

Python: from collections import Counter
x=input().split()
x_len=[len(i) for i in x ]
counter=Counter(x)
for i in range(len(x)):
    if max(x_len)==x_len[i]:
        print(max(counter),x[i])

Python: from collections import Counter


def main():
    inp = input().strip().split(' ')

    k = Counter()

    maxlen = 0
    maxlenword = ''
    for z in inp:
        k[z] += 1

        if len(z) > maxlen:
            maxlenword = z
            maxlen = len(z)

    maxi = k.most_common(1)[0][0]

    print(maxi, maxlenword)

if __name__ == '__main__':
    main()

Python: import collections
l=input().split()
print(sorted(collections.Counter(l).items(),key=lambda x:x[1])[-1][0],
      sorted(l,key=len)[-1])

Python: S = input()
W = S.split()
ws = {}
for w in W:
    if not w in ws:
        ws[w] = [1, len(w)]
    else:
        ws[w][0] += 1
print(max(ws.items(), key = lambda x: x[1][0])[0], max(ws.items(), key = lambda x: x[1][1])[0])