in reply to Code Shortening (golf) [RESOLVED]

i like this puzzle/question.
how about just looking up the position of each capital letter (discounting first one), to see that the position aligns with modulus 4. totally untested proof of concept code below
$n+=4-len($`)%4 for(/[A-Z]/g);print $n-4;
maybe wiser monks (with access to perl) could try or comment.
the hardest line to type correctly is: stty erase ^H

Replies are listed 'Best First'.
Re^2: Code Shortening (golf)
by Young Monk (Novice) on Oct 20, 2010 at 13:31 UTC
    Actually, my solution is similar to yours. The elongated solution is:
    $n+=3-length($_)%4 for<>=~/(.*?)[A-Z]/g;print$n-3

    Lately, I found out about the bit-wise operator '&' and substituted it.