// element occurrences in list
static int countOccurrencesIC(Collection<S> c, S x) {
  int n = 0;
  if (c != null) for (S o : c)
    if (eqic(x, o))
      ++n;
  ret n;
}

// string occurrences in string (not counting overlapping)
static int countOccurrencesIC(S s, S x) {
  int i = 0, nx = l(x), count = 0;
  if (nx == 0) ret 0;
  while ((i = indexOfIC(s, x, i)) >= 0) {
    ++count;
    i += nx;
  }
  ret count;
}