#C14164. FizzBuzz

    ID: 43783 Type: Default 1000ms 256MiB

FizzBuzz

FizzBuzz

This problem is a classic programming challenge known as FizzBuzz. Given a positive integer \(n\), your task is to generate a sequence of strings representing the numbers from 1 to \(n\) with the following substitutions:

  • For numbers that are multiples of 3, output "Fizz" instead of the number.
  • For numbers that are multiples of 5, output "Buzz" instead of the number.
  • For numbers that are multiples of both 3 and 5 (i.e. multiples of \(15\)), output "FizzBuzz" instead of the number.

The output should be a single line where each element is separated by a space.

inputFormat

The input is read from standard input (stdin) and consists of a single integer (n) (where (1 \leq n \leq 10^5)) on one line.

outputFormat

Print the FizzBuzz sequence for numbers from 1 to (n) on one line. Each element in the sequence should be separated by a single space. Replace multiples of 3 with "Fizz", multiples of 5 with "Buzz", and multiples of both 3 and 5 with "FizzBuzz".## sample

15
1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz