static int maxRunlengthOfRepeatingChars(S s) { if (empty(s)) ret 0; int max = 0; for (int i = 0; i < l(s); ) { char c = s.charAt(i); int j = i+1; while (j < l(s) && s.charAt(j) == c) ++j; int n = j-i; max = max(max, j-i); i = j; } ret max; }