Separating in lines

Given a natural number n, a base b, and a natural number q, print n in
base b, but placing the digits of n in groups of q at every line.

Input

Input consists of several cases, each with n > 0, 2 ≤ b ≤ 10, and q > 0.

Output

For every case, print n in base b, but placing q digits at every line.
If the number of digits of n in base b is not a multiple of q, the first
line must be the shortest. Print a line with 10 dashes at the end of
every case.

Observation

You should not use vectors or alike to solve this problem.

Problem information

Author: Unknown
Translator: Salvador Roura

Generation: 2026-01-25T12:01:29.174Z

© Jutge.org, 2006–2026.
https://jutge.org
