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: x = input().lower()

term_data = {}
for word in x.split():
  if term_data.get(word) is None:
    term_data[word] = [0, len(word)]
  term_data[word][0] += 1

term_data = [(term, data) for term, data in term_data.items() ]
print(max(term_data, key=lambda x:x[1][0])[0], max(term_data, key=lambda x:x[1][1])[0] )

Python: import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

from collections import deque,defaultdict,Counter
def main():
    S = input().split()
    S[0] = S[0].lower()
    c = Counter(S)

    often = sorted(list(c.items()),key = lambda x:-x[1])[0][0]
    longest = sorted(list(c.keys()),key = len)[-1]
    print(often,longest)
if __name__ == '__main__':
    main()

Python: date = list(map(str,input().split()))
Num = 0
Size = 0
for tag in sorted(set(date), key=date.index):
    if date.count(tag) > Num:
        Num = date.count(tag)
        Ooi = tag
    if len(tag) > Size:
        Size = len(tag)
        Msiz = tag
print(Ooi,Msiz)

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: if __name__ == '__main__':
    a = input().split()
    countWords = []
    lenWords =[]
    for x in a:
        countWords.append(a.count(x))
        lenWords.append(len(x))
    print(a[[i for i,x in enumerate(countWords) if x == max(countWords)][0]],a[[i for i,x in enumerate(lenWords) if x == max(lenWords)][0]])

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

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

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

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: sentence=input()
list=[]
list=sentence.split()
c=[]
k=0
l=0
for i in range(len(list)):
    c.append(0)
    m=len(list[i])
    if(m>k):
        k=len(list[i])
        max=list[i]
for i in range(len(list)):
    for j in range(len(list)):
        if(i!=j and list[i]==list[j]):
            c[i]=c[i]+1
for i in range(len(c)):
    if(c[i]>l):
        l=i
print("%s %s"%(list[l],max))

Python: n=list(input().split())
x=0
y=0
a=''
b=''
for i in (n):
    if x<n.count(i):
        x=n.count(i)
        a=i
    if y<len(i):
        y=len(i)
        b=i
print(a,b)

Python: import collections

slist = list(map(str, input().split()))

sc = collections.Counter(slist)

common = sc.most_common()[0][0]

max = ""

for s in slist:
    if len(max) < len(s):
        max = s

print(common, max)

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

Python: a= list(input().split())
b={}
for w in a:
    if not(w in b):
        b[w]=1
    else:
        b[w]+=1

max_word=" "
max_num= a[0]

for w in b:
    if len(max_word)< len(w):
        max_word= w
    if b[w]> b[max_num]:
        max_num= w
print(max_num,max_word)

Python: import collections
c = collections.Counter(input().split())
longest = ''
for word in c:
    if len(longest) < len(word):
        longest = word

print(c.most_common(1)[0][0], longest)

Python: s=input()
a=s.split(" ")

mp={}
freq=""
longest=""

mx=0
for v in a:
    #???????????°????????????
    if v in mp:
        mp[v]+=1
    else:
        mp[v]=1

    if mx<mp[v]:
        freq=v
        mx=mp[v]

    #?????????????????´??°
    if len(longest)<len(v):
        longest=v

print(freq,longest)

Python: s = input().split()

len_id = 0; max_len = 0
cnt_id = 0; max_cnt = 0

for i in range(len(s)):
    l = len(s[i])
    c = s.count(s[i])
    if l > max_len:
        max_len = l
        len_id = i
    if c > max_cnt:
        max_cnt = c
        cnt_id = i
print(s[cnt_id], s[len_id])

Python: from operator import itemgetter
sentence = list(input().split())
max_length = 0
max_sentence = ""
count = []
for i in range(len(sentence)) :
    if max_length < len(sentence[i]) :
        max_length = len(sentence[i])
        max_sentence = sentence[i]
    new_word = False
    for j in range(len(count)) :
        if count[j][0] == sentence[i] :
            new_word = True
            count[j][1] += 1
            break
    if new_word == False :
        count.append([sentence[i], 1])
count = sorted(count, key = itemgetter(1), reverse = True)
print(count[0][0], max_sentence)

Python: text = input().split()
print(max(text, key = lambda w: text.count(w)), max(text, key = lambda w: len(w)))

Python: line = [i for i in input().split()]
a = 0
b = ""
c = 0
d = ""
for i in range(len(line)):
    if i == 0:
        a = line.count(line[i])
        b = line[i]
        c = len(line[i])
        d = line[i]
    elif line.count(line[i]) > a:
        a = line.count(line[i])
        b = line[i]
    if len(line[i]) > c:
        c = len(line[i])
        d = line[i]
print(b+" "+d)

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

Python: from collections import Counter
if __name__ == '__main__':

    A = input().split()
    
    c = Counter(A)
    ans = c.most_common(1)
    print(ans[0][0],max(A,key=len))

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

Python: from collections import Counter
s = list(input().split())
c = Counter(s)
n,m = 0,0
for e in s:
    if n < len(e):
        n = len(e)
        m = e
print(c.most_common()[0][0],m)

Python: S = input().split()

l = 0
n = 0
L = "a"
N = "a"

for i in range(len(S)) :
    if S.count(S[i]) > n :
        n = S.count(S[i])
        N = S[i]
    
for i in range(len(S)) :
    if len(S[i]) > l :
        l = len(S[i])
        L = S[i]
        
print(N, L)

Python: words = list(map(str, input().strip().split()))
lenAndWords = [0, '']
modeWords = {}
mode = [0, '']

for s in words:
    if len(s) > lenAndWords[0]:
        lenAndWords[0] = len(s)
        lenAndWords[1] = s

    if not s in modeWords:
        d = {s:0}
        modeWords.update(d)
    else:
        modeWords[s] += 1

    if mode[0] < modeWords[s]:
        mode[0] = modeWords[s]
        mode[1] = s

print(mode[1], lenAndWords[1])

Python: word_l = input().split()
dic = {}

for w in word_l:
    try:
        dic[w] += 1
    except:
        dic[w] = 1

l_w = max(word_l, key=len)
p_w = max(dic.items(), key=lambda x:x[1])
print(p_w[0], l_w)

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

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

Python: list = input().split()

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

Python: x = input().split()
l = ""
m = 0
Count = 0
mostword = ""

for i in range(len(x)):
    if len(x[i]) > len(l):
        l = x[i]

for j in range(len(x)):
    a = x[j]
    Count = x.count(a)
    if Count > m: 
        m = Count
        mostword = a

print(mostword, l)

Python: dic = {}
max_num = 0 
max_word = ""
for word in input().split():
    if word in dic:
        dic[word] += 1
    else:
        dic[word] = 1 

    if max_num <= len(word):
        max_num = len(word)
        max_word = word

print(max(dic, key=dic.get), max_word)