#C1575. Fizz Buzz Sequence
Fizz Buzz Sequence
Fizz Buzz Sequence
You are given a list of integers. For each integer in the list, perform the following transformation:
- If the integer is divisible by 3, replace it with Fizz.
- If it is divisible by 5, replace it with Buzz.
- If it is divisible by both 3 and 5, replace it with FizzBuzz.
- If none of the above conditions hold, keep the number as it is.
The transformed numbers should be output as a single space-separated string.
Note: All formulas or conditions used in your explanation are expressed in LaTeX format if necessary. For instance, the divisibility condition for both 3 and 5 can be written as: \(n \bmod 3 = 0 \text{ and } n \bmod 5 = 0\).
inputFormat
Input is read from standard input (stdin). The first line contains a single integer (n) representing the number of elements in the list. The second line contains (n) integers separated by spaces.
outputFormat
Output the transformed sequence as a single line to standard output (stdout), with the elements separated by a single space.## sample
5
1 3 5 15 7
1 Fizz Buzz FizzBuzz 7