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 __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], max(counter, key=len))

Python: import sys
f = sys.stdin

rhombus = oblong = 0
for line in f:
    a, b, c = map(int, line.split(','))
    if a == b:
        rhombus += 1
    if a * a + b * b == c * c:
        oblong += 1

print(oblong)
print(rhombus)

Python: import collections
a=list(map(str,input().split()))
c = collections.Counter(a)
d=0
for i in range(len(a)):
    b=len(a[i])
    if d<b:
        d=b
        e=i
print(c.most_common()[0][0],a[e])

Python: # -*- coding: utf-8 -*-

import sys
import os
import datetime

d = {}
words = input().split()
longest_word = ''
for word in words:
    if len(word) > len(longest_word):
        longest_word = word

    if word not in d:
        d[word] = 1
    else:
        d[word] += 1

max_value = max(d.values())

for key in d.keys():
    if d[key] == max_value:
        print(key, longest_word)

Python: from statistics import *
words = [w.lower() for w in input().split()]
words.sort(key=len, reverse=True)
print(mode(words), words[0])

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):
        ansLen = word
print(ansNum, ansLen)

Python: from collections import Counter

dic_str = {}
strings = input().split()
dic_str = Counter(strings)

key_max = 0
val_max = 0
key_str = ''
val_str = ''
for k,v in dic_str.items():
  if len(k) > key_max:
    key_max = len(k)
    key_str = k
  if v > val_max:
    val_max = v
    val_str = k

print(val_str, key_str)

Python: import collections
s=list(map(str,input().split()))
nc=collections.Counter(s)
ans_most=nc.most_common(1)[0][0]
ans_long=""
for i in s:
    if len(ans_long)<len(i):ans_long=i
print(ans_most,ans_long)

Python: a=input().strip().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: word_list = input().split(' ')

word_dict = {}

longest_word_len = 0
longest_word = ''

high_freq_word_num = 0

for word in word_list:
    if longest_word_len < len(word):
        longest_word_len = len(word)
        longest_word = word

    if word not in word_dict:
        word_dict[word] = 1
    else :
        word_dict[word] += 1

    if high_freq_word_num < word_dict[word]:
        high_freq_word_num = word_dict[word]

for word in word_list:
    if word_dict[word] == high_freq_word_num:
        print(word + ' ' + longest_word)
        break

Python: #0029
import collections
l =[]
word = input()
words = word.split(' ')
c = collections.Counter(words)
C = c.most_common(1)

for i in words:
    l.append(len(i))
for i in words:
    if max(l) == len(i):
        print(C[0][0],i)

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

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

Python: from collections import Counter
seq = list(input().split())
mode_word = ''
cnt = 0
for k, v in Counter(seq).items():
    if cnt < v:
        mode_word = k
        cnt = v
max_count_word = ''
for s in seq:
    if len(max_count_word) < len(s):
        max_count_word = s
print(mode_word, max_count_word)

Python: # coding: utf-8

from collections import Counter

s = input().strip().split(" ")
most_freq = Counter(s).most_common()[0][0]
max_len = sorted([(len(x), x)for x in s], reverse=True)[0][1]

print("{} {}".format(most_freq, max_len))

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
print(c[1]+" "+d)

Python: import sys
f = sys.stdin

import collections
c = collections.Counter(f.readline().lower().split())

longest = ''
for word in c:
    if len(longest) < len(word):
        longest = word

print(max(c), longest)

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: from collections import Counter
l = input().split()
print(Counter(l).most_common(1)[0][0], sorted(l, key=len)[-1])

Python: # -*- coding:utf-8 -*-

string = list(str(input()).split(' '))
l = [0]*len(string)
k = 0
for i in range(len(string)):
    if len(string[i]) > k:
        k = i
    for j in range(len(string)):
        if string[i] == string[j]:
            l[i] += 1
m = l.index(max(l))
print(string[m],string[k],sep = ' ')

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

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
for k,v in mostfre.items():
    if v > temp:
        temp = v
        ansfre = k
print(ansfre + ' ' + longest[1])

Python: text = [s for s in input().split()]
s_text = set(text)
a, b = 0, 0
for s in s_text:
    if text.count(s) > a:
        a = text.count(s)
        x = s
    if len(s) > b:
        b = len(s)
        y = s
print(x, y)

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

Python: n=input().split()
mx = 0
mx2 = 0
for i in n:
    if mx < len(i):
        mx = len(i)
        mxm = i
    elif mx2 < n.count(i):
        mx2 = n.count(i)
        mxh = i
print(mxh,mxm)

Python: from collections import Counter
instr = input().split()
ctr = Counter(instr)

print(ctr.most_common(1)[0][0], end =" ")

ans = ""
for word in instr:
    if len(word)>len(ans): ans = word
print(ans)

Python: import collections
x = input().split()
c = collections.Counter(x)
max = 0
for i in range(len(x)):
   a = len(x[i])
   if a>max:
      max = a
      M = x[i]
print(c.most_common()[0][0], M)

Python: a = input()

a = a.split()

ans1 = max(a,key=a.count)

ans2 = max(a,key=len)

print(ans1,ans2)

Python: # -*- coding:utf-8 -*-

def main():
    LIST=[]

    while True:
        try:
            val=input().split()
            LIST=[]
            
            
            for v in val:
                flag=True
                for item in LIST:
                    if item[0]==v:
                        index=LIST.index(item)
                        flag=False

                if flag:
                    LIST.append([v,1])
                else:
                    LIST[index][1]+=1

            longest=""
            LIST=sorted(LIST,key=lambda x:x[1],reverse=True)
            for i in LIST:
                longest=i[0] if max(len(longest),len(i[0]))==len(i[0]) else longest

                
            ans=LIST[0][0]
            print("{0} {1}".format(ans,longest))

        except:
            break

    
if __name__ == '__main__':
    main()