The function f(x) rearranges the characters in the input string by swapping the positions of specific characters.
