We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Cat program

From Esolang
(Redirected from Reverse cat program)
Jump to navigation Jump to search
Not to be confused with Cat Program (language), nor Cat (Language).
For the concatenative language, see catlangwiki:Cat.

The cat program is a program that copies its standard input to its standard output. It is named after the Unix command cat, although this command is actually more powerful. The cat program is a popular problem.

cat has also been described humorously as a programming language in which every program is a quine. The programming language is obviously of very limited computational usefulness. See HQ9+ and Text.

Hello world and quine program

#!/usr/bin/cat
Hello, world!

You must chmod +x the program file to make it executable:

$ chmod +x file

To execute it:

$ ./file

(assuming file is the filename of the program)

Reverse cat

Other shell commands could be used in similar way, so there is reverse variant of cat language too. Unix command line utilities in this space include both rev (reversing characters within each line) and tac (reversing the order of lines in the input; cat backwards).

 $ echo '!dlrow ,olleH' | rev
 Hello, world!
 $ (echo 'world!'; echo 'Hello,') | tac
 Hello,
 world!
 $ (echo '!dlrow'; echo ',olleH') | tac | rev    # or ... | rev | tac
 Hello,
 world!

A simple "reverse cat" program could simply output the bytes of the input backwards, which for a conventional newline-delimited text file has roughly the effect of rev and tac combined (except for the treatment of the file's trailing newline).

While a regular cat program requires only O(1) storage space, a reverse cat program requires O(n) storage space, so as a popular problem it is a slightly more ambitious achievement.

Implementations

綠酒千杯腸已爛

與君六千七百九十八杯酒。可以窮歡宴。綠酒一杯歌一遍。
與君六千七百九十七杯酒。可以窮歡宴。綠酒一杯歌一遍。
……
與君三杯酒。可以窮歡宴。綠酒一杯歌一遍。
與君二杯酒。可以窮歡宴。綠酒一杯歌一遍。
與君一杯酒。可以窮歡宴。綠酒一杯歌一遍。
綠酒千杯腸已爛。

‰

i.

^English

Print the user’s input.

!!brainfeed

^.

... Bottles of beer on the wall

.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. bottles of beer on the wall, .............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. bottles of beer.
Take one down and pass it around, ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. bottles of beer on the wall.

…… (a lot of characters ommited)

... bottles of beer on the wall, ... bottles of beer.
Take one down and pass it around, .. bottles of beer on the wall.

.. bottles of beer on the wall, .. bottles of beer.
Take one down and pass it around, . bottle of beer on the wall.

. bottle of beer on the wall, . bottle of beer.
Take one down and pass it around, no bottles of beer on the wall.

No bottles of beer on the wall, no bottles of beer.
Go to the store and buy some more, .............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. bottles of beer on the wall.

Assemble

$st ""
ipt st
dvr st
pas
brk

brainfuck

,[.,]

Befunge

~,

C

#include <stdio.h>
int main(){while((char c=getchar())!=EOF){putchar(c);}}

Doki!

MC[Choose Option]"Type Something!"
Act 3:Monika[Var]"Cat", Input(Line 1)
MC[Give Poem]Cat
Act 4:Sayori[Thank You]

Dotfuck

..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
................................................

Deadfish+

ofjpog

Español

Leer la pagina en esta wiki sobre "Cat program"
Este programa simula ese programa.

ExampleFuck

Hello World
FizzBuzz
Polyglot
Self Interpreter
99 Bottles of Beer

Fish Code

<,.{0}><

Mesmerizer

Teto:

Ready for Performance!
Quiz Time! “Type something!”
Resist Teto
Wait
Resist Teto
Send Message Output
Resist Teto
Shut Down…

Miku:

Ready for Performance!
Wait
Wait
Set the Stage “Output” to Input!
Wait
Wait
Wait
Shut Down…

Pepe

REEe Reee

Python

print(input())

RAGE!!!

<rant>
WHY DOES K MEAN THE SAME THING AS WHAT YOU'RE ABOUT TO TELL ME
SCREAM K!!!
</rant>

Regards,

Reads until the end of input, one character at a time.

Subject: Fwd: Fwd: Fwd: FW: read this

Hi all,

FYI, forwarding this exactly as I received it.

Just to level-set, letter is 0.
Reading between the lines.

Per my last email, while we're over -1 on letter:
> Let me spell it out.
> Reading between the lines.

Best,
Ihor

Simpl

print(usrinp())

SpoilerFuck

,.,

Truths-machine

truths(i, o=i out(o))

Tol

toltoLToLTOlTOL

Unary (compressed)

56623

Unary

000000000
... (a lot of chars omitted)
000000000

Vegetable Juice

You like it, don’t you? “How long is your string?:”
“Length” flavored Vegetable Juice is on sale now for 200 yen!
Come on! Come on!
I have decided now that Length must love this drink!
Aggressively Advertise Vegetable Juice at 5% off for 17 Yen Length times!
You like it, don’t you? “Give Miku a Value between 0 and 255:”
“Cat” flavored Vegetable Juice is on sale now for 200 yen!
Come on! Come on!
I have decided now that Cat must love this drink!
You like it, don’t you? “Do 0 if you want number, 1 if you want ASCII.”
“ASCII” flavored Vegetable Juice is on sale now for 200 yen!
Come on! Come on!
I have decided now that ASCII must love this drink!
I’ve decided, ASCII=0
Aaaaaaaaaa! Cat!
I’ve decided just now.
Now drink it! Cat!
So drink it!
All sold out!

Zidryx myno

dfwbh(wbdih())

See also