you strip off empty pots and chunk s0 and look up the rules in a set instead of calling str.find() a bunch of times