python
beginner
已解决
2026-11-17 结束
Run-length encoding
Write two functions:
encode(text)turns runs of the same character into count + character:"aaabcc"becomes"3a1b2c".decode(data)reverses it:"3a1b2c"becomes"aaabcc". Counts can have several digits ("12x").
Acceptance criteria
decode(encode(s)) == sfor any text without digits.- Empty input gives empty output.
- The tests at the bottom print
All tests passed.
目前已有 0 人解出。
编辑器Ctrl + Enter
当测试输出 "All tests passed" 时,此挑战会在本浏览器中标记为已解决。
提交您的解决方案进行审核