36
2
Given a snippet of fizz buzz output with all numbers removed, fill in the correct numbers with the lowest possible values such that the fizz buzz snippet is correct. For the purposes of this challenge, fizz
and buzz
have their usual values of 3 and 5, respectively.
If the input is an invalid sequence of fizz
, buzz
and empty lines, then instead output just zzubzzif
(with or without newlines).
Input and output may be newline separated lines, or whatever array-of-strings format is convenient to your language.
You may ignore or do whatever you like with capitalisation.
You will need to choose to handle one or more of these: fizzbuzz
, fizz buzz
, buzz fizz
, etc, but you must choose at least one of these formats.
You may assume that all input is some sequence of fizz
, buzz
and empty lines.
Examples
Input:fizzOutput:
2
fizz
4
Input:
buzz fizzOutput:
buzz
fizz
7
Input:
fizzbuzzOutput:
13
14
fizzbuzz
16
17
Input:
Output:
1
Input:
fizz fizzOutput:
zzubzzif
Input:
Output:
zzubzzif
Related. – Martin Ender – 2015-10-17T19:56:02.370