14997 - More Popcornnnnn   

Description

"I have something I'd like to say - Lizard. Lizard. Lizard."

Tom is a lizard who has a massive crush on popcorn. Even though a single piece of popcorn is almost as big as his mouth, he still enjoys it immensely.

As Tom's loyal fan, you decide to give him a huge bucket of popcorn! But before doing so, you must tell Tom exactly how many pieces of popcorn you are giving him, as counting is simply too difficult for a lizard. Being smart, you have already figured out that there are exactly pieces of popcorn in the bucket.

However, in the lizard world, they do not use the decimal system, nor do they use Arabic numerals. Instead, these are decided based on their mood for the day. Specifically, Tom will give you a positive integer , representing the base of the numeral system he wants to use today.

Then, he will give you a string of length , representing the symbols Tom uses to express numbers. Specifically, (the -th character of string , 0-indexed) corresponds to the digit value in this base- system.

For example, if and "AB", it means Tom wants to use the binary (base-2) system today. The traditional 0 is replaced by 'A', and the traditional 1 is replaced by 'B'. Therefore, the decimal number 13 (which is 1101 in binary) must be represented as B B A B in Tom's eyes.

Given the string provided by Tom, please convert into base and output the result. Each digit should be separated by a space.

Update: If you keep getting Presentation Error, it might be a problem with blank spaces at the end of lines.

Tip: You may use " S = S[::-1] " to reverse a string S, for example
> S = "abc"
> S = S[::-1]
> print(S) # You'll get "cba"

Input

The input is given from Standard Input in the following format:


  • Guarantee that is composed of unique ASCII characters

Output

Using , output in -based system, with a space between every two digits.

Sample Input  Download

Sample Output  Download

Tags




Discuss