#37183: python 紀錄


BensonDC (python戰士)

學校 : 不指定學校
編號 : 240921
來源 : [1.175.217.87]
最後登入時間 :
2024-03-27 12:33:26
g005. 倒置文章 (Inversion) -- TOI練習賽202105新手組第2題 | From: [36.238.105.93] | 發表日期 : 2023-08-23 22:25

S=input()
L=[]
Lo=['+']
temp=[]
for i in S:
    if i=='+' or i=='-':
        L.append(temp)
        Lo.append(i)
        temp=[]
    else:
        temp.append(i)
L.append(temp)
temp=[]
for i in zip(L,Lo):
    if i[1]=='-':
        print(*i[0][::-1],sep='',end='')
    else:
        print(*i[0],sep='',end='')

 
ZeroJudge Forum