static int getRepeatCount(final int p, final char[] chars) {
        int i = 1;
        char opCode = chars[p];
        while (p + i < chars.length && chars[p + i] == opCode) {
            i++;
        }

        return i;
    }