How do I code this in Brainfuck?

636 views Asked by At

You are given an upper case alphabet C and a single digit number K. Print the alphabet D which is K the alphabet in the order,

That is, print a single character C+K

For example:

A+3 = D
Q+9 = Z

Input Format

The single line of input consists of two characters, C and K, not space separated (refer sample input)

Constraints:

It is guaranteed that the input character will be from 'A' to 'Q' and number 1 to 9 so you don't have to worry about boundary conditions.

Output Format

Print a single upper case character

Sample Input

A3

Sample Output

D

This is what I have so far.

, > , ----- ----- ----- ----- ----- ----- ----- ----- -----
2

There are 2 answers

2
Kashif Faraz Shamsi On BEST ANSWER

I have landed up on a solution.

Here is the code.

, > , ----- ----- ----- ----- ----- ----- ----- ----- ----- --- [< + > -] <.
0
Sirmyself On

Here's an other solution:

,>, >+++++[<--- --- --->-]<--- [<+>-]<.

instead of counting every '-' or '+', I like to make mathematical functions that will input the number I want in fewer characters. In the previous example, I did 5*-9 -3 = -48

I could also do this

,>, >+++ +++[<---- ---->-] <[<+>-]<.

6x-8 = -48