4 ms·
By saving all the input in memory (EDIT: or to a file, as another comment points out) until EOF, then writing the lines out in reverse order. It's not really p
by umanwizard 6y ago
By saving all the input in memory (EDIT: or to a file, as another comment points out) until EOF, then writing the lines out in reverse order.
It's not really possible to do in a stateless/streaming way.