this breaks calling it twice with different input
initial answer for beer in ruby