Tac

Return lines in reverse order.

IN

qwer
asdf
zxcv

OUT

zxcv
asdf
qwer

IN

11

OUT

11

IN

!@#$
%^&*

OUT

%^&*
!@#$
Login to submit solution


28 symbols perl failed test 1 Wrong answer
zxcvasdf
qwer
instead of
zxcv
asdf
qwer
Wed Sep 11 17:27:53 2013 avkhozov
#!/usr/bin/perl -n
push@a,$_}{print reverse@a
15 symbols perl failed test 1 Wrong answer

                      
instead of
zxcv
asdf
qwer
Thu Dec 26 22:39:23 2013 Anton Cheshkov
lines . reverse
17 symbols haskell failed test 1 Code error

code:1:1: Parse error: naked expression at top level Perhaps you intended to use TemplateHaskell

Thu Dec 26 22:40:56 2013 Anton Cheshkov
(lines . reverse)
16 symbols ruby2.0 failed test 1 Wrong answer
zxcvasdf
qwer
instead of
zxcv
asdf
qwer
Fri Dec 27 03:46:00 2013 Logioniz
puts exec('tac')
16 symbols perl failed test 1 Wrong answer
zxcvasdf
qwer
instead of
zxcv
asdf
qwer
Thu Jan 9 09:38:48 2014 yanick
print reverse <>
19 symbols perl failed test 1 Wrong answer
zxcvasdf
qwer
instead of
zxcv
asdf
qwer
Thu Jan 9 09:41:32 2014 yanick
print reverse @a=<>
15 symbols perl failed test 1 Wrong answer
zxcvasdf
qwer
instead of
zxcv
asdf
qwer
Fri Jan 10 17:59:08 2014 bugov
print reverse<>
21 symbols perl failed test 1 Wrong answer
zxcvasdf
qwer
instead of
zxcv
asdf
qwer
Sat Jan 11 11:11:24 2014 bugov
#!/usr/bin/perl -n
@a=($_,@a)}{print@a
23 symbols perl failed test 1 Wrong answer
zxcvasdf
qwer
instead of
zxcv
asdf
qwer
Sat Jan 11 11:14:11 2014 bugov
#!/usr/bin/perl -n
unshift@a,$_}{print@a
94 symbols python3 failed test 1 Code error

Traceback (most recent call last): File "./code", line 4, in <module> n = input() EOFError: EOF when reading a line

Thu Feb 6 15:12:07 2014 maksim
l = []
n = 1
while n:
    n = input()
    l.append(n)
print('\n'.join(l[::-1]).strip(),end='')
47 symbols haskell failed test 1 Code error

code:1:28: Couldn't match type ‘[]’ with ‘IO’ Expected type: IO Char Actual type: [Char] In the first argument of ‘(>>=)’, namely ‘reverse x’ In the expression: reverse x >>= putStr code:1:42: Couldn't match type ‘[Char]’ with ‘Char’ Expected type: Char -> IO () Actual type: String -> IO () In the second argument of ‘(>>=)’, namely ‘putStr’ In the expression: reverse x >>= putStr

Mon May 26 14:36:06 2014 ledyba
main=getContents >>= \x -> reverse x >>= putStr
41 symbols haskell failed test 1 Wrong answer
vcxz
fdsa
rewq
instead of
zxcv
asdf
qwer
Mon May 26 14:41:35 2014 ledyba
main=getContents>>= \x->putStr$reverse x
42 symbols haskell failed test 1 Wrong answer
vcxz
fdsa
rewq
instead of
zxcv
asdf
qwer
Mon May 26 14:43:29 2014 ledyba
main=getContents>>= \x->putStrLn$reverse x
7 symbols bash failed test 1 Code error

tail: invalid option -- 'r' Try 'tail --help' for more information.

Mon May 26 15:04:40 2014 ledyba
tail -r
3 symbols bash failed test 1 Wrong answer
zxcvasdf
qwer
instead of
zxcv
asdf
qwer
Mon May 26 15:06:14 2014 ledyba
tac
46 symbols haskell failed test 1 Wrong answer
zxcv
asdf
qwer
[(),(),()]
instead of
zxcv
asdf
qwer
Mon May 26 15:15:21 2014 f4_alt
main=getContents>>=mapM putStrLn.reverse.lines
46 symbols haskell failed test 1 Wrong answer
zxcv
asdf
qwer
[(),(),()]
instead of
zxcv
asdf
qwer
Mon May 26 15:18:53 2014 f4_alt
main=getContents>>=mapM putStrLn.reverse.lines
67 symbols haskell failed test 1 Wrong answer
zxcv
asdf
qwer
[(),(),()]
instead of
zxcv
asdf
qwer
Mon May 26 15:19:31 2014 f4_alt
import Control.Monad
main=getContents>>=mapM putStrLn.reverse.lines
46 symbols haskell failed test 1 Wrong answer
zxcv
asdf
qwer
[(),(),()]
instead of
zxcv
asdf
qwer
Mon May 26 15:20:43 2014 f4_alt
main=getContents>>=mapM putStrLn.reverse.lines
59 symbols haskell failed test 1 Code error

code:1:6: Not in scope: ‘catch’

Mon May 26 15:28:30 2014 ledyba
main=catch (getLine >>= putStrLn >> main) (const return$())

View all solutions