# Painting with CSE

A software development company near Polashi, Dhaka is famous for their product Bitmap Update & Editing Tool (BUET). This software uses text commands to draw objects. A subset of the text commands is used in drawing straight lines and rectagles. This subset is known as Compound String Expression for Drawing, Editing & Plotting recTangles (CSE DEPT). The CSE commands has the following elements: • A point is represented by two integers x and y separated by comma (‘,’) and surrounded by parentheses (‘(’ and ‘)’). • An object consists of at least one point separated by commas ( ‘,’) and surrounded by square brackets (‘[’ and ‘]’). Two consecutive points in an object must be the same or represent a horizontal or vertical line. The sequence of n points in an object represents a sequence of n − 1 lines, found by joining each consecutive pair of points. • Two objects can be added using the function A(obj1, obj2). These two object can be added if the last point of obj1 is the same as the first point of obj2. The function returns another object having all the points of obj1 and obj2 in the same order (the common ‘middle’ point apears only once, however). • A list of objects is either a single object or the result of one of the following functions: – T(dx, dy, ListExpr) returns a list with all points in all objects in the list expression (defined below) ListExpr translated towards (dx,dy) (i.e. all x’s are increased by dx and all y’s are increased by dy). – S(fx, fy, ListExpr) returns a list with all points in all objects in the expression ListExpr scaled by (fx,fy) (i.e. all x’s are multiplied by fx and all y’s are multiplied by fy). – R(theta, ListExpr) returns a list with all points in all objects in the expression ListExpr rotated counter clockwise by the angle theta. theta must a multiple of 90 and can be negative. • A list expression is at least one list separated by lower case ‘u’. It means a set-union of the lists. Given a list expression, you are to draw the bitmap in the format shown in the sample. Spaces are allowed in the input. Pixels having x or y less than 0 or greater than 9 are to be ignored. Input Input consists of several input strings, one in each line. The end of input is marked with a line consisting of a single ‘#’ mark. Input may contain any character, but all except the ones mentioned above indicates error. Input can be upto 120 characters long. Integers can be negative. You can assume that there will be at most 20 points in any object, and at most 20 objects in any list. Output For each dataset, print the set number (1,2,...) in a line followed by the 10 × 10 bitmap. Lower left corner is the pixel (0,0). A blank is marked by a dot, while a dark pixel is marked by a hash sign. An error in input should result in a bitmap having a question mark at the pixel (0,0).

2/3 Sample Input [(0,0),(1,0)] u R( 90, [(2,0),(5,0)] ) [(0,0),(1,0)] u T( 5,5, [(0,0)] u [(1,0)] u A([(2,0),(5,0)],[(5,0),(5,5)]) ) T( 5,5, S(2,2 2, [(0,0),(1,0)] )) T( 5,5, R( 90, S(2,2, [(0,0),(1,0)] )) )

Sample Output Set #1 .......... .......... .......... .......... #......... #......... #......... #......... .......... ##........ Set #2 .......... .......... .......... .......... .....##### .......... .......... .......... .......... ##........ Set #3 .......... .......... .......... .......... .......... .......... .......... .......... .......... ?......... Set #4 .......... .......... .....#.... .....#.... .....#.... .......... ..........

3/3 .......... .......... ..........