#P373. 练64.2 图像旋转翻转变换
练64.2 图像旋转翻转变换
Description
Given the grayscale values of pixels in an image, perform a series of operations in sequence and output the final image.
The possible operations and their corresponding characters are as follows:
: Rotate degrees clockwise;
: Rotate degrees counterclockwise;
: Flip horizontally;
: Flip vertically.
Input Format
First line contains two positive integers and , representing the number of rows and columns of the image, separated by a single space. , .
Next lines, each containing integers, represent the grayscale values of each pixel in the image, with adjacent numbers separated by a single space. Grayscale values range from to .
Next line contains a string composed of characters , , , and , representing the sequence of operations to be performed. The length of is between and .
Output Format
Output lines, each containing integers, representing the grayscale values of the final image. Here is the number of rows in the final image, and is the number of columns. Adjacent integers are separated by a single space.
Sample
2 3
10 0 10
100 100 10
AC10 100
0 100
10 10