Calculate input for given result and sanitizing rules


I’m looking for a way to code a program that calculates the input for given result and sanitizing rules in python/or as a concept.
For example, there are 2 given rules:

  1. Replace “(=” to “(!–”
  2. Replace “=)” to “=–)”

The result should be:

I’m looking for the input.

Do you have an idea how to solve this problem with a program?

I’m grateful for every input.

Your requirements are unclear. You want code that tells you what’s being sanitized? Or you want your code to sanitize?

The result can’t be “(=abc=)” since “(=” and “=)” would’ve been replaced.
Don’t you mean that for example you have “(!–abc=–)” and want to know what was entered before?

I think you can do that with a simple if statement if I read it right.
like this
new_thing = None
for parts in inputs:
if parts == (!:
new_thing .append(part you want
elif parts == =)
new_thing.append(part you want)