Simplify logic for inverted strings.