Code Golf
add tag
Since TopAnswers already [has]( a post stolen from [Martin Ender](, let's steal another one! Your task is to write a program that copies an input taken from STDIN to STDOUT. [Link](

|  Input | Output |
Top Answer LaTeX
# LaTeX/Ti*k*Z





Answer #2
# Polyglot ([W], [GolfScript], [Flurry]), 0 bytes


Works in at least W, Golfscript [(GS: TIO)][TIO-k7am8gmc], and Flurry, likely more. These languages push input to the stack and implicitly print the stack at the end. They accept input in any format and get converted to strings for output.

[TIO-k7am8gmc]: "GolfScript – Try It Online"
Answer #3 APL (Dyalog Unicode)
# [APL (Dyalog Unicode)], 1 [byte]( "When can APL characters be counted as 1 byte each?") ([SBCS]( ".dyalog files using a single byte character set"))

Full program.


[Try it online!][TIO-k88n336w]

`⍞` prompts from stdin, with printing to stdout happening implicitly.

[APL (Dyalog Unicode)]:
[TIO-k88n336w]: "APL (Dyalog Unicode) – Try It Online"
Answer #4 Ahead
# [Ahead], 4 bytes
This program will not write to STDOUT until STDIN is closed or empty.

    S slurp stdin to string
    U reverse string
    W write string
    @ end

[Try it online!][TIO-k7mzpytr]

[TIO-k7mzpytr]: "Ahead – Try It Online"
Answer #5
# [Rust], 75 bytes

    ||{use std::io::*;for x in stdin().bytes(){stdout().write(&[x.unwrap()]);}}


    // closure with no arguments
    || {
        use std::io::*;			// This is shorter than the prelude
        for x in stdin().bytes() {
            	&[				// Stdout::write takes an &[u8]
                	x.unwrap()	// x is a Result<u8, std::io::Error>

[Try it online!][TIO-kb7rtjac]

[TIO-kb7rtjac]: "Rust – Try It Online"
Answer #6
# [Nim], 26 bytes

    stdout.write stdin.readAll

[Try it online!][TIO-khok7ad4]

[TIO-khok7ad4]: "Nim – Try It Online"
Answer #7
[MAWP 0.1](, 7 bytes
|        push all input characters as ascii values
0        push 0 to stack
~        reverse stack
[        start of loop. If no input, skip loop due to 0
;        print as ascii char
]        loop end. If all ascii values printed, end loop due to 0
.        terminate program
Answer #8
# [FRACTRAN], 0 bytes


[Try it online!][TIO-kcg70e0i]

Were this just another stack lang, I'd comment on that one. This one works differently however:

1. For the first fraction f in the list for which *n × f* is an integer, replace *n* by *n × f*
2. Repeat this rule until no fraction in the list produces an integer when multiplied by *n*, then halt.

Thus the empty program immediately halts after being unable to find a suitable fraction, and spits back the input. (Only gives/takes numbers as IO.)

Interestingly, there's no other FRACTRAN cat program. It would have to only consist of fractions *1/n* where *n*'s prime factors are all larger than any of the inputs.

Therefore, only if you know the the input will never be greater than *k*, could you generate another (infinite) valid FRACTRAN program, eg. *1/p* where *p > n* & *p* is prime

[TIO-kcg70e0i]: "FRACTRAN – Try It Online"

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.