2
コメント私が試したコードは、Pythonプログラムは、ここで
from re import *
commentStart = compile('/\*')
commentEnd = compile('\*/')
singleComment = compile('//')
quotes = compile('".*"')
def readComment(line):
while(line):
if(commentEnd.match(line)):
return
line = input()
line=input()
while(line):
if(quotes.match(line)):
print(line)
line = input()
continue
elif(commentStart.match(line)):
readComment(line)
line=input()
continue
elif(singleComment.match(line)):
line=input()
continue
else:
print(line)
line=input()
である私は、単一の行のコメントを削除することができるよしかし、私は、複数行のコメントに問題があります。
サンプル入力:
abcd
//blah
efg
/*blah
blah
blah*/
hij
マイ出力:
abcd
efg
予想される出力:
abcd
efg
hij
私はミスを犯してきたところを指摘してください。ありがとうございました。
あなたが回答を受け取った場合は、それを受け入れたことを示す必要があります。 –