Neal Becker wrote: > I meant #occurrences of characters from the set A in string B If a contains "few" characters: n = sum(b.count(c) for c in a) If a contains "many" characters: identity = "".join(map(chr, range(256))) n = len(b) - len(b.translate(identity, a)) Peter