# Find triples in the DNA below

trip_count = Hash.new

while line = gets
        line.scan(/(...)/).each { |trip|
#	triples = line.scan(/(...)/)
#        triples.each { |trip|
		if ! trip_count.member? trip then
			trip_count[trip] = 0
		end
		trip_count[trip] += 1
	}
end

# (Sort in decreasing order)
trip_count \
# sort takes a comparator, optionally, where a and b are k,v pairs
	.sort { |a,b| b[1] <=> a[1] } \
	.each { |k,v|
	puts "#{k} : #{v}"
}

