// returns l(s) if not found
static int smartIndexOf(S s, S sub, int i) {
if (s == null) ret 0;
i = s.indexOf(sub, min(i, l(s)));
ret i >= 0 ? i : l(s);
}
static int smartIndexOf(S s, S sub) {
ret smartIndexOf(s, sub, 0);
}
static int smartIndexOf(L l, A sub) {
ret smartIndexOf(l, sub, 0);
}
static int smartIndexOf(L l, A sub, int start) {
int i = indexOf(l, sub, start);
ret i < 0 ? l(l) : i;
}