Compress a string such that 'AAABCCDDDD' becomes 'A3BC2D4'. Only compress the string if it saves space.
- Can we assume the string is ASCII?
- Yes
- Note: Unicode strings could require special handling depending on your language
- Is this case sensitive?
- Yes
- Can we use additional data structures?
- Yes
- Can we assume this fits in memory?
- Yes