well, I'm newly introduced to befunge. it seems to be an amazing language but a bit hard to start with! anyway after about 2 hours of hard work I've created a code which could read a line from stdin and write same line into stdout(I'm using line -1 as buffer in this code):

0> :~:a-#v_$$v vg-10:-1< >$>:#,_@
 ^+1p-10\<   >0>\:    #^_^

since I'm new to this language I wanted to know if there is a shorter code to do such a thing. I'm currently using Rc/funge-98 v2 interpreter. note that none-trailing whitespaces are counted in your code.


3 Answers 3


Befunge-98, 4


Try it online!

It works because ~ acts like r when there is no more input (credit to David Holderness for finding this in the funge-98 spec)


Befunge, 10


You were thinking a bit too hard about it I think :)

  • \$\begingroup\$ now I see what you did there, it seems to be complete answer. I was going to later use input string to parse as a "single precision floating point", which seems to be not possible using your method. \$\endgroup\$
    – Ali1S232
    Commented Mar 19, 2012 at 11:15
  • \$\begingroup\$ the only reason I'm not accepting your answer is because I know an answer of 7 characters. \$\endgroup\$
    – Ali1S232
    Commented Mar 20, 2012 at 13:52
  • \$\begingroup\$ @Gajet you should post it \$\endgroup\$
    – ajax333221
    Commented Mar 20, 2012 at 16:02
  • \$\begingroup\$ @ajax333221 I want to give other people opportunity to get 15 rep. \$\endgroup\$
    – Ali1S232
    Commented Mar 20, 2012 at 17:43

since it seems no one could create 7 character program, here is what I did. it works at least with befunge!

Befunge, 7

  • \$\begingroup\$ @ajax333221 here is my code. \$\endgroup\$
    – Ali1S232
    Commented Mar 21, 2012 at 14:13
  • \$\begingroup\$ but this does not output the newline. \$\endgroup\$
    – marinus
    Commented Mar 24, 2012 at 21:40
  • \$\begingroup\$ @marinus that's no big deal, just putting "," at the third character will solve that! the whole idea is to use "j" instead of "!#@_" \$\endgroup\$
    – Ali1S232
    Commented Mar 24, 2012 at 23:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.