import sys
op=True
for line in sys.stdin:
for ch in line:
if ch =='"':
if op:
print("``",end='')
else:
print("''",end='')
op = not op
else:
print(ch,end='')
設定一個op變數在True跟Flase之間切換,當op是True時將"改成``,反之改成'',若沒遇到引號就正常輸出ch。
記住每個輸出結尾要加空字串,不然會有空格。