The function takes a string as input and returns a modified string based on predefined rules.
