It's not clear how to choose which letter is counted, but you can find how to count from /help $count
//echo -a $count(moon,n)
and you can capitalize them and replace them with:
//echo -a $upper( $replace(moon,o,x) )
You can find additional examples of $replace and other identifiers at https://en.wikichip.org/wiki/mirc/identifiers/$replace
Note that $replace and $replacex have 2 similar but different behaviors.