# [ ] indented prints after every step
+ Replaces text according to the given rules. Guarantees
+ that replacements won't affect each other.
+ Raises TypeError when rule returns invalid result.
texts =  # store processed pieces
subst =  # store replacements
+ "Rule '%s' returned %d element(s) instead of 3"
+ % (rule.__name__, len(res)))
# replacing current text with three elements