Đăng nhập để hỏi chi tiết
Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
fi = open('BAI2.INP', 'r')
fo = open('BAI2.OUT', 'w')
s = fi.read()
x = '0'
res = ''
for i in s:
if i.isdigit():
if i >= x[-1]:
x += i
elif len(x) > 2:
res += x[1:]
x = '0' + i
else:
x = '0' + i
elif len(x) > 2:
res += x[1:]
x = '0'
else:
x = '0'
fo.write(res)
fi.close()
fo.close()
Hãy giúp mọi người biết câu trả lời này thế nào?
Xem thêm:
Bảng tin