Skip to main content
Fixed '*' command, removed '$<.each'
Source Link
Lowjacker
  • 4.9k
  • 1
  • 19
  • 19

Ruby 1.9, 159159 156

This program generates files named "1", "2", "3" and so on.

b={}
I=1
eval T="$<.eachT="loop{|l|cc,d=ld=gets.split
d ?c==?*?b={}:d ?c==?!?b.delete(d):c==???puts(b[d]):b[c]=d :break}
open(I.to_s,?w){|f|f<<'b=%p
I=%d
eval T=%p'%[b,I+1,T]}"

Ruby 1.9, 159

This program generates files named "1", "2", "3" and so on.

b={}
I=1
eval T="$<.each{|l|c,d=l.split
d ?c==?*?b={}:c==?!?b.delete(d):c==???puts(b[d]):b[c]=d :break}
open(I.to_s,?w){|f|f<<'b=%p
I=%d
eval T=%p'%[b,I+1,T]}"

Ruby 1.9, 159 156

This program generates files named "1", "2", "3" and so on.

b={}
I=1
eval T="loop{c,d=gets.split
c==?*?b={}:d ?c==?!?b.delete(d):c==???puts(b[d]):b[c]=d :break}
open(I.to_s,?w){|f|f<<'b=%p
I=%d
eval T=%p'%[b,I+1,T]}"
Source Link
Lowjacker
  • 4.9k
  • 1
  • 19
  • 19

Ruby 1.9, 159

This program generates files named "1", "2", "3" and so on.

b={}
I=1
eval T="$<.each{|l|c,d=l.split
d ?c==?*?b={}:c==?!?b.delete(d):c==???puts(b[d]):b[c]=d :break}
open(I.to_s,?w){|f|f<<'b=%p
I=%d
eval T=%p'%[b,I+1,T]}"