#K59242. Fizz Replacement List

    ID: 30821 Type: Default 1000ms 256MiB

Fizz Replacement List

Fizz Replacement List

You are given two positive integers \(n\) and \(m\). Your task is to generate a list of integers from 1 to \(n\) such that every integer that is a multiple of \(m\) is replaced by the string "Fizz".

Details:

  • The input consists of two space-separated integers \(n\) and \(m\), where \(n \ge 1\) and \(m \ge 1\).
  • For each integer \(i\) from 1 to \(n\):
    • If \(i\) is divisible by \(m\), output "Fizz".
    • Otherwise, output \(i\) itself.
  • The output should be the modified list printed in one line with a single space separating each element.

inputFormat

Standard input contains two integers \(n\) and \(m\) in one line separated by spaces. Both are guaranteed to be at least 1.

outputFormat

Print the list from 1 to \(n\) with every multiple of \(m\) replaced by "Fizz". The output should be a single line with elements separated by a single space.

## sample
5 3
1 2 Fizz 4 5