i = 0 while i < len(s): c = s[i] j = i + 1 while j < len(s) and s[j].isnumeric(): j += 1 count = int(s[i + 1:j]) for _ in range(count): res += c i = j
print(res)
asd7160
2022-08-23 14:49:49 +08:00
……高中生来这里白嫖作业题答案嘛
JasonEWNL
2022-08-23 14:50:00 +08:00
(1)
www
(2)
10 * n + int(ch) result += n * s1 i += 1
```python s = input('data: ') + ' . ' n = 0 result = '' s1 = s[0] i = 1 while i <= len(s) - 1: ch = s[i] if ch >= '0' and ch <= '9': n = 10 * n + int(ch) else: result += n * s1 s1 = ch n = 0 i += 1 # 原题缩进有问题 print(result) ```