static int endOfLeadingInteger(S s) {
  if (empty(s)) ret 0;
  int start = 0;
  if (s.charAt(0) == '-') ++start;
  int i = start;
  while (i < l(s) && isDigit(s.charAt(i))) ++i;
  ret i > start ? i : 0;
}