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: 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: 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: A=list(map(str,input().split()))
#print(A)
max_length=0
maximum_number_of_letters=""
max_cnt=0
frequent_word=""
for i in A:
	if len(i)>max_length:
		maximum_number_of_letters=i	
		max_length=len(i)
	if A.count(i)>max_cnt:
		frequent_word=i
		max_cnt=A.count(i)
print(frequent_word,maximum_number_of_letters)

Python: s=list(input().split())


num1=1
tmp1=0
for i in range(len(s)):
    if tmp1>num1:                                       #出現頻度が高い
        #print("tmp1",tmp1)
        num1=tmp1
        list1=s[i-1]
    tmp1=0
    for m in range(len(s)):
        if s[i]==s[m]:
            tmp1+=1

for l in range(len(s)-1):                               #単語が一番長い
    if len(s[l])>len(s[l+1]):
        tmp2=s[l+1]
        s[l+1]=s[l]
        s[l]=tmp2

print(list1,s[len(s)-1])

Python: l = input().split()
s = set(l)
a = 0
b = 0
J = ''
K = ''
for i in s:
    if l.count(i) > a:
        a = l.count(i)
        J = i
    if len(i) > b:
        b = len(i)
        K = i
print(J,K)

Python: import collections
s = str(input())
S = []
A = []
l = s.split(' ')
S.extend(l)
c = collections.Counter(S)
L = len(S)
for i in range(L):
    a = S[i]
    A.append(a)
    A.sort(key=len,reverse=True)
print(c.most_common()[0][0], A[0])

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

s = raw_input()
most_arise(s)

Python: import sys
f = sys.stdin

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

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

print(max(c), longest)

Python: s=input().split()
print(max(s,key=s.count),max(s,key=len)) 
#max()はkeyに別の関数を指定してその返り値が最大となる要素を返す

Python: str = input().split()
mfw = ""
mlw = ""
maxF = 0
maxL = 0
for w in str:
    if str.count(w) > maxF:
        mfw = w
        maxF = str.count(w)
    if len(w) > maxL:
        mlw = w
        maxL = len(w)
print(mfw, mlw)

Python: # coding=utf-8

###
### for python program
###

import sys
import math

# math class
class mymath:
    ### pi
    pi = 3.14159265358979323846264338

    ### Prime Number
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []

        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist

    def pnum_check(self, n):
        if (n==1):
            return False
        elif (n==2):
            return True
        else:
            for x in range(2,n):
                if(n % x==0):
                    return False
            return True

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    ### LCM
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

    ### Mat Multiplication
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans

mymath = mymath()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        #print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#N = int(input())
#A, B, C = [x for x in input().split()]
#N, K = [int(x) for x in input().split()]
#inlist = [int(w) for w in input().split()]

#R = float(input())
#A.append(list(map(int,input().split())))

#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]

#abc list
#abc = [chr(ord('a') + i) for i in range(26)]

### output sample
# print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
# print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
# print(" {}".format(i), end="")

# def printA(A):
#     for i, n in enumerate(A):
#         print(n, end='')
#         if i != N-1:
#             print(' ', end='')
#     print()

# リスト内包表記 ifあり
# [x-k if x != 0 else x for x in C]

# ソート
# N = N.sort()

# 10000個の素数リスト
# P = mymath.pnum_eratosthenes(105000)

def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()

def dist(A, B):
    d = 0
    for i in range(len(A)):
        d += (A[i]-B[i])**2            
    d = d**(1/2)
    return d

def get_input():
    N = []
    while True:
        try:
            N.append(input())
            #N.append(int(input()))
            #N.append(float(input()))
        except EOFError:
            break
    return N

S = [x for x in input().split()]

Z = {}

for s in S:
    if s in Z.keys():
        Z[s] += 1
    else:
        Z[s] = 1

maxlen = 0
maxlenstr = ''

maxnum = 0
maxnumstr = ''

for z in Z:
    if maxlen < len(z):
        maxlen = len(z)
        maxlenstr = z
    if maxnum < Z[z]:
        maxnum = Z[z]
        maxnumstr = z

print(maxnumstr,maxlenstr,sep=' ')

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 a[seq]<a[i]:
        seq=i
    if len(leng)<len(i):
        leng=i
print(seq,leng)

Python: text = list(input().split())

count = []
length = []

for i in range(len(text)):
    count.append(text.count(text[i]))
    length.append(len(text[i]))

c = count.index(max(count))
l = length.index(max(length))

print(text[c],text[l])

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

Python: memo = {}
many, length = '', ''
max_val, max_len = 0, 0

word = input().split()

for _ in word :
    if _ in memo :
        memo[_] = memo[_] + 1
        if max_val < memo[_] : 
            max_val == memo[_]
            many = _
    else :
        memo[_] = 1
        if max_len < len(_) :
            max_len = len(_)
            length = _

print(many, length)

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

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