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:

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:

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

Complete the following file:


public class Compressor { public String compressImage(String imageColors) { // your work here } }