Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- code = [x for x in input().split(" ")]
- ascii_number = []
- new_code = []
- for x in code:
- word = [y for y in x]
- for y in word:
- if y.isdigit():
- ascii_number.append(y)
- else:
- break
- for z in ascii_number:
- word.remove(str(z))
- ascii_word = chr(int(''.join(ascii_number)))
- new_code.append(str(ascii_word))
- first_symbol = word[0]
- second_symbol = word[len(word) - 1]
- word.remove(first_symbol)
- if len(word) > 0:
- word.remove(second_symbol)
- new_code.append(second_symbol)
- new_code.extend(word)
- new_code.append(first_symbol)
- new_code.append(" ")
- ascii_number.clear()
- print(''.join(new_code))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement