统计字符出现次数
int countOccurrences(String pattern) { return RegExp.escape(pattern).allMatches(this).length; }