-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy path1451.py
More file actions
32 lines (29 loc) · 758 Bytes
/
Copy path1451.py
File metadata and controls
32 lines (29 loc) · 758 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
while True:
try:
texto = input()
tam = len(texto)
ponto = 1
palavra = ''
temp = ''
for letra in range(tam):
ch = texto[letra]
if ch != '[' and ch != ']':
if ponto:
palavra += ch
else:
temp += ch
if ch == '[':
if ponto:
ponto = 0
else:
palavra = temp + palavra
temp = ''
elif ch == ']':
ponto = 1
palavra = temp + palavra
temp = ''
if temp:
palavra = temp + palavra
print(palavra)
except EOFError:
break