class Array def dividable_by_3 (sum % 3).zero? end def dividable_by_5 (alternating_sum % 5).zero? end def alternating_sum x = 0 is_positive = true each do |i| if is_positive x += i is_positive = false else x -= i is_positive = true end end x end end def solve tmp = (N.dividable_by_3 ? 'Fizz' : '') + (N.dividable_by_5 ? 'Buzz' : '') tmp == '' ? N.join : tmp end N = gets.chomp.chars.map(&:to_i) puts solve