Magical BF 1
문제
John learned at school that in many East Asian languages texts can be written from left to right as well as from top to bottom. He got especially curious whether it's possible to write a text such that it can simultaneously be read both ways. John kept puzzling in programming class as well and now wants to write code such that it would solve the tasks when read by rows (top to bottom and left to right), as well as when read by columns (left to right and top to bottom). Naturally, he needed a suitable language for this and John chose a language called BF for experimenting.
The memory of a BF program is an infinite array with cells numbered from left to right (, , \ldots). Each cell contains a nonnegative integer that can be arbitrarily large. Additionally there is a data pointer that in the beginning of execution points to the leftmost cell ().
The execution of a program starts from its first command and in general after the execution of each command the program moves on to the next command in the sequence. Altogether there are six commands in the language, each one denoted by one character:
| Command | Meaning |
|---|---|
> |
Moves the data pointer to the right by one cell. |
< |
Moves the data pointer to the left by one cell if the data pointer does not point to the leftmost cell; otherwise does nothing. |
+ |
Increases the cell at the data pointer by one. |
- |
Decreases the cell at the data pointer by one if the cell is currently positive; otherwise does nothing. |
[ |
If the cell at the data pointer is zero, then jumps forward to the corresponding ']' symbol; otherwise does nothing. |
] |
If the cell at the data pointer is nonzero, then jumps back to the corresponding '[' symbol; otherwise does nothing. |
Help John write magical BF programs for solving the five tasks listed below.
As a solution to each task submit an grid of BF program code (where ). The code does not have to be the same when read by rows and by columns, but must solve the task correctly in both cases. The solution text can only contain the characters '>', '<', '+', '-', '[' and ']' and must completely fill the grid. For any allowed input, the code must not execute more than million commands.
Task: The cells and of the array contain the integers and (), all other cells contain zeros. Write the difference into the cell .
Input example: [이미지 1]
Output example: [이미지 2]
In the output, it only matters that the cell contains the difference of and (in this case, ), other cells may contain any numbers (for example, , , , \ldots).