static int countChar(S s, char c) { int n = 0, l = l(s), i = 0; while true { int j = s.indexOf(c, i); if (j < 0) break; ++n; i = j+1; } ret n; }