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)) == s for any text without digits.
  • Empty input gives empty output.
  • The tests at the bottom print All tests passed.

अब तक 0 लोगों ने हल किया।

python
एडिटरCtrl + Enter

            
        

जब टेस्ट "All tests passed" दिखाते हैं, तो चैलेंज इस ब्राउज़र में हल के रूप में चिह्नित हो जाता है।

अपना समाधान समीक्षा के लिए भेजें