sS onlyChars(S chars, S s) { if (empty(chars)) ret ""; int n = l(s); new StringBuilder buf; char c; for i to n: if (contains(chars, c = s.charAt(i))) buf.append(c); ret str(buf); }