"a3b1a1c2". You are given such a record in packed.
Compress it better: every letter must appear in the record exactly once, with its total count, and the letters must be in alphabetical order. The original order of characters is lost, and that is intended.
Return the new record.packed='b2a5b10' → 'a5b12'
The letter b appears twice: 2 + 10 = 12. Sorted alphabetically, that gives "a5b12".
packed='c3a1c1a2' → 'a3c4'
a: 1 + 2 = 3, c: 3 + 1 = 4.
packed='z1' → 'z1'
len(packed) ≤ 6·10⁴packed is well formed: a lowercase English letter followed by a numberpacked='b2a5b10'
'a5b12'
Run checks the first 3 tests in your browser. Submit checks all 70 tests on the server, hidden ones included.