numbers = gets.chomp.split('').map(&:to_i) another = [] pattern_count = 0 while numbers.size > 1 another.push(numbers.shift) next if numbers.first.zero? || another.first.zero? pattern_count += 1 end puts pattern_count