#!/usr/bin/env ruby class CharsRepeat def self.number_of_repeaters string chars = Hash.new 0 string.each_char { |char| chars[char] += 1 } chars.select { |char,count| count > 1 } end end p CharsRepeat.number_of_repeaters 'teestting'