当前位置: 首页 > 工具软件 > SmartIDE > 使用案例 >

HackerRank - "Building a Smart IDE: Identifying comments"

党源
2023-12-01
import re

import io
import sys
input_stream = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8')

s = input_stream.readlines()
s = "\n".join(s)

pc = '(//.*|/\*[\d\D]*?\*/)'
mc = re.findall(pc, s)
for v in mc:
    vs = v.split("\n\n")
    for l in vs:
        print (l.lstrip())

转载于:https://www.cnblogs.com/tonix/p/4548203.html

 类似资料: