-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path17413.py
More file actions
41 lines (34 loc) · 754 Bytes
/
17413.py
File metadata and controls
41 lines (34 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import sys
item = sys.stdin.readline().strip("\n")
tag = False
result = []
temp = []
for i in item:
if i == "<":
tag = True
if len(temp) != 0:
result.append(temp[::-1])
temp.clear()
result.append(i)
continue
elif i == ">":
tag = False
result.append(i)
continue
elif i == " ":
if tag:
result.append(i)
else:
result.append(temp[::-1])
temp.clear()
result.append(i)
continue
if tag:
result.append(i)
else:
temp.append(i)
else:
result.append(temp[::-1])
temp.clear()
for i in result:
print("".join(i), end="")