Forums Programming Assignment Help The function prints a compressed version of the array string

This topic contains 0 replies, has 1 voice, and was last updated by  Aakanksha 6 years, 6 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #8501

    Aakanksha
    Participant

    I have to write function void printCompressed(char *string)

    The function prints a compressed version of the array string. You may assume as a precondition that the last

    character in string is null (which is represented in C by ”). To encode a string, we replace every sequence of

    repeated letters with the single letter followed by the length of the sequence.

    For example, zzz is replaced by z3

    a is replaced by a1

    so my question is how can I write ‘zzz’ into ‘z3’

    ‘aaabbbccc’ to ‘a3b3c3’

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.