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.
manatwork
- 20.9k
- 5
- 53
- 82