406434: GYM102409 F Ironical Solution 1

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

F. Ironical Solution 1time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Diego wants to message his friend Ketzia, for this he will first grab a word and encode it as numbers and then apply some encryption to the numbers and send it to her. Ironically, after coming up with this solution he realized that this system has to send word by word, only works for words were every letter is in alphabetical order and also there are many chat services that are free and will encrypt messages securely so there was no need to invent this encryption system.

In order to encrypt Diego will first grab a word of $$$N$$$ characters and convert every character into its numerical ASCII (for example 'A' -> 65, '0' -> 48, 'a' -> 97). After that he will have exactly $$$N$$$ positive numbers.

Given those $$$N$$$ numbers, he will generate all possible $$$2^N$$$ subsets and then for each subset get the sum of all the numbers in the subset, he will then sort the sums and send them to Ketzia. She will decrypt the message by doing the inverse of the encryption steps.

For this particular problem, he will do the encryption of the message.

Input

An integer $$$N$$$ $$$(1 \le N \le 20)$$$, the amount of characters that the word that Diego is sending to Ketzia has. The word will have its characters sorted in non-decreasing order by ASCII value.

A single word of length $$$N$$$ containing only lower and upper case letters and numbers.

Output

$$$2^N$$$ numbers sorted in non-decreasing order in the same line, the encrypted word.

ExampleInput
5
Beery
Output
0 66 101 101 114 121 167 167 180 187 202 215 215 222 222 235 268 281 281 288 288 301 316 323 336 336 382 389 402 402 437 503

Source/Category

加入题单

算法标签: