단어 단위로 [::-1]해서 출력하면 되는데
캡션 '< >'에 들어온 애들은 역순하지 않고 출력한다 (공백이 포함되어도 마찬가지)
이때 단어는 영어랑 숫자 조합이고, split()으로 구분하자
text = input()
ans = ''
tmp = ''
text = list(text)
while text:
now = text.pop(0)
if now == '<':
ans += tmp[::-1] + now
tmp = ''
now = text.pop(0)
while now != '>':
ans += now
now = text.pop(0)
ans += '>'
else:
if now != ' ':
tmp += now
else:
ans += tmp[::-1] + now
tmp = ''
print(ans+tmp[::-1])