Removing the suffix and prefix substrings which already forms a palindrome and storing them in separate strings
prefix = st [ : length ] NEW_LINE suffix = st [ n - length : ] NEW_LINE st = st [ length : n - 2 * length + length ] NEW_LINE