Stack

Stack it :3

IN

add 1
add 3
add 3
add 7
pop
pop
add 9
pop
pop

OUT

7
3
9
3

IN

add 7
add 7
pop
pop
add 7
pop

OUT

7
7
7

IN

add 1
add 2
add 3
add 4
pop
pop
pop
pop

OUT

4
3
2
1
Login to submit solution


71 symbols ruby2.0 failed test 1 Wrong answer

                      
instead of
7
3
9
3
Fri Aug 8 21:08:40 2014 Nakilon
@stack = []
def add x
  @stack.push x
end
def pop
  puts @stack.pop
end
78 symbols python2 failed test 1 Code error

Traceback (most recent call last): File "./code", line 3, in <module> b=raw_input().split() EOFError: EOF when reading a line

Sat Aug 9 15:38:05 2014 PFischbeck
a=[]
while 1:
 b=raw_input().split()
 if b[0]<'b':a+=b[1:]
 else:print a.pop()
36 symbols ruby2.0 failed test 1 Code error

./code:1:in `gets': No such file or directory @ rb_sysopen - add 1 (Errno::ENOENT) from ./code:1:in `gets' from ./code:1:in `block in <main>' from ./code:1:in `loop' from ./code:1:in `<main>'

Sat Aug 9 20:01:45 2014 nooodl
loop{gets[4]?$*<<$_:puts($*.pop[4])}
108 symbols python2 failed test 1 Code error

File "./code", line 4 try l.split(): ^ SyntaxError: invalid syntax

Sun Aug 10 18:27:04 2014 vik
import sys
a=[]
for l in sys.stdin:
 try l.split():
  except:print a.pop()
 else:a.append(int(l.split()[1]))
97 symbols python2 failed test 1 Code error

File "./code", line 4 try l=l.split()[1]: ^ SyntaxError: invalid syntax

Sun Aug 10 18:28:24 2014 vik
import sys
a=[]
for l in sys.stdin:
 try l=l.split()[1]:
  except:print a.pop()
 else:a.append(l)
97 symbols python2 failed test 1 Code error

File "./code", line 5 l=l.split()[1]: ^ SyntaxError: invalid syntax

Sun Aug 10 18:28:59 2014 vik
import sys
a=[]
for l in sys.stdin:
 try:
  l=l.split()[1]:
except:print a.pop()
else:a.append(l)
99 symbols python2 failed test 1 Code error

File "./code", line 5 l=l.split()[1]: ^ SyntaxError: invalid syntax

Sun Aug 10 18:29:31 2014 vik
import sys
a=[]
for l in sys.stdin:
 try:
  l=l.split()[1]:
 except:print a.pop()
 else:a.append(l)
110 symbols python2 failed test 1 Code error

File "./code", line 5 l=int(l.split()[1]): ^ SyntaxError: invalid syntax

Sun Aug 10 18:35:58 2014 vik
import sys
a=[]
for l in sys.stdin:
 try:
  l=int(l.split()[1]):
 except:
  print a.pop()
 else:
  a.append(l)
105 symbols python2 failed test 1 Code error

File "./code", line 5 l=l.split(): ^ SyntaxError: invalid syntax

Sun Aug 10 18:37:42 2014 vik
import sys
a=[]
for l in sys.stdin:
 try:
  l=l.split():
 except:
  print a.pop()
 else:
  a.append(l[1])
106 symbols python3 failed test 1 Code error

File "./code", line 5 l=l.split(): ^ SyntaxError: invalid syntax

Sun Aug 10 18:38:11 2014 vik
import sys
a=[]
for l in sys.stdin:
 try:
  l=l.split():
 except:
  print(a.pop())
 else:
  a.append(l[1])
105 symbols python2 failed test 1 Code error

File "./code", line 5 b=l.split()[1]: ^ SyntaxError: invalid syntax

Sun Aug 10 18:45:03 2014 vik
import sys
a=[]
for l in sys.stdin:
 try:
  b=l.split()[1]:
 except:
  print a.pop()
 else:
  a.append(b)
112 symbols python2 failed test 1 Code error

File "./code", line 4 b=l ^ IndentationError: expected an indented block

Sun Aug 10 18:45:44 2014 vik
import sys
a=[]
for l in sys.stdin:
b=l
 try:
  b=b.split(' ')[1]:
 except:
  print a.pop()
 else:
  a.append(b)
110 symbols python2 failed test 1 Code error

File "./code", line 5 b=l.split(' ')[1]: ^ SyntaxError: invalid syntax

Sun Aug 10 18:46:18 2014 vik
import sys
a=[]
for l in sys.stdin():
 try:
  b=l.split(' ')[1]:
 except:
  print a.pop()
 else:
  a.append(b)
108 symbols python2 failed test 1 Code error

File "./code", line 5 b=l.split(' ')[1]: ^ SyntaxError: invalid syntax

Sun Aug 10 18:47:04 2014 vik
import sys
a=[]
for l in sys.stdin:
 try:
  b=l.split(' ')[1]:
 except:
  print a.pop()
 else:
  a.append(b)
27 symbols bash failed test 1 Code error

./code: line 1: dc: command not found

Mon Aug 11 01:32:56 2014 jcowgill
sed s/add//|sed s/op/Sa/|dc
42 symbols perl failed test 1 Wrong answer
7393
instead of
7
3
9
3
Tue Sep 16 02:25:19 2014 maxymania
m'.* (.*)'?push@_,$1:print(pop(@_))while<>
12 symbols ruby2.0 failed test 1 Wrong answer
1
3
3
7
9
instead of
7
3
9
3
Sun Oct 5 19:14:55 2014 fl00r
#!/usr/bin/ruby2.0 -p
$_=$_[4,2]
24 symbols ruby2.0 failed test 1 Wrong answer
1
3
3
7
9
instead of
7
3
9
3
Sun Oct 5 19:17:03 2014 fl00r
#!/usr/bin/ruby2.0 -p
$_=$:<<$_[4,2]&&$:.pop
28 symbols ruby2.0 failed test 1 Wrong answer
7393
instead of
7
3
9
3
Sun Oct 5 19:29:56 2014 fl00r
#!/usr/bin/ruby2.0 -n
$_[4]?$:<<$_[4]:$><<$:.pop
167 symbols nodejs failed test 1 Wrong answer
7
3
9
instead of
7
3
9
3
Fri Feb 27 05:00:26 2015 bluebear94
r=require('readline')
s=[]
l=r.createInterface({input:process.stdin,output:process.stdout})
l.on('line',function(c){c[0]=='a'?s.push(c.slice(4)):console.log(s.pop())})

View all solutions