Bases and bars

Write a program that, given two numbers nn and bb, prints the digits of nn in base bb as shown in the examples. For every digit dd, print a line with dd capital exes. Print the digits from right to left.

Input

Input consists of a natural number nn between 1 and 10610^6, followed by a natural number bb between 2 and 100.

Output

For every digit dd of nn represented in base bb, and starting from the digit with less weight, print a line of size dd made up of only ‘X’. Print a line with 10 dashes at the beginning and at the end of the output.

Problem information

Author: Unknown
Translator: Salvador Roura

Generation: 2026-01-25T11:13:25.362Z

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