count = Hash.new(0)
longest = ''

$<.each_line do |line|
	line.split.each do |word|
		count[word] += 1
		longest = word if longest.size < word.size
	end
end

puts count.max_by(&:last).first + ' ' << longest