Keg, (削除) 19 (削除ここまで) 17 characters
?{!1<|=[|0.(_)]}1
Explanation:
? # read input
{ # while
!1< # stack length greater than 1?
| # end of while condition and beginning of while block
= # compare the 2 top values in the stack
[ # if (the condition is the top of stack)
| # end of then block and beginning of else block
0. # output 0
(_) # clear stack (discard top of stack in for loop stack length times)
] # end if
} # end while
1 # stack is already empty, push a truthy value
# implicitly output the stack content if there was no explicit output
Keg, (削除) 19 (削除ここまで) 17 characters
?{!1<|=[|0.(_)]}1
Explanation:
? # read input
{ # while
!1< # stack length greater than 1?
| # end of while condition and beginning of while block
= # compare the 2 top values in the stack
[ # if (the condition is the top of stack)
| # end of then block and beginning of else block
0. # output 0
(_) # clear stack (discard top of stack in for loop stack length times)
] # end if
} # end while
1 # stack is already empty, push a truthy value
# implicitly output the stack content if there was no explicit output
Keg, 19(削除) 19 (削除ここまで) 17 characters
?({!2/|=[|01-1<|=[|0.(_)])}1
I found no way to break a for loop, so I clear the stack to avoid getting a "-1" for each non-matching pair. This has the drawback of occasionally getting error message on STDERR, after displaying the correct result on STDOUT.
Keg, 19 characters
?(!2/|=[|01-.(_)])1
I found no way to break a for loop, so I clear the stack to avoid getting a "-1" for each non-matching pair. This has the drawback of occasionally getting error message on STDERR, after displaying the correct result on STDOUT.
Keg, 19 characters
?(!2/|=[|01-.(_)])1
I found no way to break a for loop, so I clear the stack to avoid getting a "-1" for each non-matching pair. This has the drawback of occasionally getting error message on STDERR, after displaying the correct result on STDOUT.