vim, 42 bytes
Better approach than my previous attempt: we can do this in parallel by having our macro only increment the counter and then replace only the Lone Ones with calls to it.
:s/111*//g
...
sed, 16 bytes
/[abipq]/{c
q};d
Prints a newline for true and an empty string for false.
Annotated
/[abipq]/{ # run grouped commands for lines matching [abipq]
c # change curr...
vim, 212 bytes
A:<ESC>"xddO11@aj044j116jdj31@ar2j242jdj314jd3j$51@ar4j42d3j512jdG<ESC>:%s/\(\d\d\)/@ar\1@bj/g
"dDqaA 0<ESC>qqbYp$<C-A>qxkDqc@a6@bjq(7@c(@doI
X
C
M<ES...