Submit | All submissions | Best solutions | Back to list |
BF - BRAINF__K DESIGN |
Problem statement:
Brainf**k is a programming language with only 8 symbols { ,.<>+-[] }. Ms.Sashwath
thought of creating a compiler with only 5 symbols { .<>+- }. In her language
0 refers to A, 1 refers to B and so on upto Z. The functionalities of the symbols are as follows
Initially i=0
. : print the value at current i
> : move one position right (i++)
< : move one position left (i--)
+ : increment the value at current i
- : decrement the value at current i
If any other character is found it is considered as a comment and is ignored.
For example ++++.>+++.<++. will print “EDG”
Because initially i=0 and value at i=0. Incrementing four times value at 0 becomes 4 which refers to E.
Then position of i is incremented. i=1 and now value at 1 is incremented 3 times and D is printed
Again the position of i is decremented. i=0. Already the value at 0 is 4 and we further increment it twice.
So it becomes 6 and it is printed as G.
INPUT:
The first line consists of an integer t, denotes the number of test cases. Then next t lines
consists of a string of length <=100
OUTPUT:
For each test case print the required result in an individual line.
EXAMPLE:
SAMPLE INPUT:
8
+++++.++++.>>>>.+++.<<<+++.++.<++KKKHJKHKHJJLKJH12132.
++++.++++.++.+...
>>>.<+.HJ<+.>+.>+.
+++.---.+-+->.<.++--+++.
++++++++UIIU++-----.>...-+><><+.
.
+++
>++++.
SAMPLE OUTPUT:
FJADDFL
EIKLLL
ABBCB
DAAAD
FAAAB
A
E
WARNING: Note that you've to handle the comments (symbols other than the specified five symbols may present in the input).
Added by: | cegprakash |
Date: | 2011-05-18 |
Time limit: | 0.100s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM32-GCC GAWK MAWK BC C-CLANG NCSHARP CPP14 CPP14-CLANG COBOL COFFEE D-CLANG D-DMD DART ELIXIR FANTOM FORTH GOSU GRV JS-MONKEY JULIA KTLN NIM NODEJS OBJC OBJC-CLANG OCT PICO PROLOG PYPY PYPY3 PY_NBC R RACKET RUST CHICKEN SED SQLITE SWIFT UNLAMBDA VB.NET |