in reply to Re: some efficiency, please
in thread some efficiency, please

Note that this also removes "ref N" when they appear inside one of the begin...end blocks; the spec is unclear whether that is desired or not. Update: The same goes for AnomalousMonk's solution. Some more test cases from the OP would be helpful here :-)

Replies are listed 'Best First'.
Re^3: some efficiency, please
by tybalt89 (Monsignor) on Apr 13, 2019 at 08:44 UTC

    <simplistic_answer> It passes *all* the test cases, therefor it's correct. </simplistic_answer>

    hehehe