String reverse in Python,print(''.join(x[::-1] for x in pattern.split(string)))