Skip to main content
deleted 10 characters in body
Source Link
digEmAll
  • 5.1k
  • 15
  • 22

R, 4845 bytes

o={};for(e in scan())ifo="if"(e)o=c,c(e,o)else o=o[,o[-1];o1]);o 

Try it online!Try it online!

  • -14 byte thanks to @Giuseppe

R, 48 bytes

o={};for(e in scan())if(e)o=c(e,o)else o=o[-1];o 

Try it online!

  • -1 byte thanks to @Giuseppe

R, 45 bytes

o={};for(e in scan())o="if"(e,c(e,o),o[-1]);o 

Try it online!

  • -4 byte thanks to @Giuseppe
added 31 characters in body
Source Link
digEmAll
  • 5.1k
  • 15
  • 22

R, 4948 bytes

foro={};for(e in scan())if(!e)F=F[-1]else F=co=c(e,Fo);F[F>0]else o=o[-1];o 

Try it online!Try it online!

  • -1 byte thanks to @Giuseppe

R, 49 bytes

for(e in scan())if(!e)F=F[-1]else F=c(e,F);F[F>0] 

Try it online!

R, 48 bytes

o={};for(e in scan())if(e)o=c(e,o)else o=o[-1];o 

Try it online!

  • -1 byte thanks to @Giuseppe
added 3 characters in body
Source Link
digEmAll
  • 5.1k
  • 15
  • 22

R, 5049 bytes

for(e in scan())'if'if(!e,F<-F[-1],F<)F=F[-c1]else F=c(e,F));F[F>0] 

Try it online!Try it online!

R, 50 bytes

for(e in scan())'if'(!e,F<-F[-1],F<-c(e,F));F[F>0] 

Try it online!

R, 49 bytes

for(e in scan())if(!e)F=F[-1]else F=c(e,F);F[F>0] 

Try it online!

Source Link
digEmAll
  • 5.1k
  • 15
  • 22
Loading