The function replaces each letter in the input string with another letter according to a specific pattern.
