#!perl s~~ @ARGV~;print$1until!s~(.)(?=(.).*\2.*\1| )~~s |
The \2 in the replacement is bad perl, but a better golf tiebreaker :)
#!perl s~~ @ARGV~;print$1until!s~(.)((.).+\3.*\1| )~\2~s |
#!perl $_=" @ARGV";print$1while+s~(.)(?=(.).*\2.*\1| )~~s |
cool, a complete YACC style shift/reduce parser...
#!perl
for(pop=~/./g,$/,$~=pop){print+pop@~while@~x$~!~/$~[-1].*$_/;push@~,$_}
|