Speed up String#count and add String#replaceAll that doesn't use regexes