Encode a string as 'frequency + character', e.g. "aabccc" is encoded as "2a1b3c".
Asked in the online screening test stage. Q1 of 2; the wording was reported as very easy.
Implement encode_string(s), which accepts a string and returns a string containing one count + character segment for each consecutive run. Counts must be written as decimal integers, and character order must be preserved.
def encode_string(s):