in reply to Re^2: Can you write a faster code to perform this task?
in thread Can you write a faster code to perform this task?

True, Rolf, I mis-read the OP's requirement. I thought he wanted the number of "M". But, OTOH, trizen has found a way to use tr/// which seems to be very fast.