Chairman of "Horns and hoofs" company, Mr. Phunt, decided to start
advertising campaign. First of all, he wants to install an indicator
panel on the main square of the city that will show advertisements of
the company. So he charged the manager of the company, Mr. Balaganov,
to do this job.
After analyzing offers of indicator panels, Balaganov ordered one
at a price of only $19999.99. But when it was delivered, a little
problem was found. The panel was programmable, but the instruction
set of the processor was a subset of brainfuck language commands.
The commands that processor was capable to execute were
'>', '<', '+', '−' and '.', which are described in the table below.
Moreover, this panel had very little memory for the program,
so not every program typing a particular string will fit into memory.
Now Balaganov wants to know the minimal program that will output the
given string. But because he is not very good at programming,
he asks you to solve this problem. The brainfuck program is a
sequence of commands executed sequentially (there are some
exceptions, but panel processor cannot execute such commands).
The brainfuck machine has, besides the program, an array of 30000
byte cells initialized to zeros and a pointer into this array.
The pointer is initialized to point to the leftmost byte of the array.
Increment the pointer (to point to the next cell to the right). If the pointer
before increment points to the rightmost byte of the array, then after
increment it points to the leftmost byte.
Decrement the pointer (to point to the next cell to the left). If the pointer
before decrement points to the leftmost byte of the array, then after increment
it points to the rightmost byte.
Increment (increase by one) the byte at the pointer. If the value of the cell
before increment is 255 then it becomes 0.
Decrement (decrease by one) the byte at the pointer. If the value of the cell
before decrement is 0 then it becomes 255.
Output the value of the byte at the pointer.
Input has one line containing the string brainfuck program must output.
Every character of the string is a small English letter ('a'–'z'). The length
of the string is not greater than 50. You may assume that optimal program will
not have to modify more than four memory cells.
Output one line with minimal brainfuck program. Any characters except
'>', '<', '+', '−' and '.' are not allowed (quotes for clarity only).
If there are several solutions any will be acceptable.
Please note that the sample output is divided into several lines only for
convenience. In the real output whole program must be printed on a single line.
Problem Source: Novosibirsk SU Contest. Petrozavodsk training camp, September 2007