in case it wasn't obvious: Spoofing made this as a joke or parody of sorts ;P he realizes $calc($len($1-) - $removecs($1-, A, B, C)) = $countcs(str, A, B, C) when A, B and C are single characters and is just mimicking the thought process of a new user to the language for nostalgic purposes (based on a comment he made earlier).
also Jethro, that regex version is incorrect; you mean to use $regml(0) in place of $regml(1) in the first case, and $1- in place of $regml(1) in the second. also, i'm not sure if you used //S out of habit since it's unnecessary here, but if you actually want to not consider control codes it would follow that you'd want to take $len($strip($1-)) as the length of the text.