为什么不对呢,用报错的输入明明可以啊

P1320 压缩技术(续集版)

AceConstant @ 2024-09-02 00:16:35

origin = input()
n = len(origin)
result = [str(n)]
for _ in range(n-1):
    origin += input()

num = 0
group = origin[0]
for i in origin:
    if i == group:
        num += 1
    else:
        result.append(str(num))
        num = 1
        group = i
result.append(str(num))
print(' '.join(result))

by shelbyloveshiking @ 2024-11-19 19:52:23

我也是,这应该是一个普遍性问题


|