A simple technique for compressing an image is run-length encoding. The color of each pixel or area is specified for an image. The color pallette can be specified by the first letter of each color (R, G, B, C, M, Y, K, W) - red, green, blue, cyan, magenta, yellow, black, white. An example 6 by 4 image is:

    RRRGGGYYYYWBWWRGBBBBBRRR
Run-length encoding counts the number of each color in a group and replaces the individual color values by a number and the color. For our example, this would give:
   3R3G4Y1W1B2W1R1G5B3R

Complete the compressImage method to run-length compress a string of characters.