Consider an image that is composed of a number of colored small squares,
each colored in one of these 8 colors: red, green, blue, cyan, magenta, yellow,
black, white. The colors are stored in a String
using the first
letter of each color (R, G, B, C, M, Y, K, W). Each row in the image is
terminated by a newline character ('\n'
). Here is an example of an
image:
String imageCode = "RRR\nRGR\nRRR\n";
This is a green square surrounded by red squares.
Your task is to write a method that doubles the image in size, making each
square twice as large in each direction. For example, when calling
doubleImage
with imageCode
, the returned image is
"RRRRRR\nRRRRRR\nRRGGRR\nRRGGRR\nRRRRRR\nRRRRRR\n"