#t143. 画布裁剪

画布裁剪

Canvas Cropping

Problem Description

Little A drew a picture on a rectangular canvas of height hh and width ww. Because there is too much blank margin around the picture, Little A wants to crop the canvas and keep only the main part of the picture. Specifically, the canvas can be viewed as a character matrix of hh rows and ww columns, where every character has an ASCII code between 3333 and 126126 (visible characters). Little A keeps only the submatrix formed by rows x1x_1 to x2x_2 and columns y1y_1 to y2y_2.

Little A hands the canvas to you. Can you help him crop it?

Input Format

The first line contains two positive integers hh and ww, the number of rows and columns of the canvas. The second line contains four positive integers x1,x2,y1,y2x_1, x_2, y_1, y_2, the kept row and column boundaries. The following hh lines each contain a string of length ww, the content of the canvas.

Output Format

Output x2−x1+1x_2 - x_1 + 1 lines, each a string of length y2−y1+1y_2 - y_1 + 1: the cropped canvas.

Sample Input

Sample Input 1

3 5
2 2 2 4
.....
.>_<.
.....

Sample Input 2

5 5
1 2 3 4
AbCdE
fGhIk
LmNoP
qRsTu
VwXyZ

Sample Output

Sample Output 1

>_<

Sample Output 2

Cd
hI

Sample Explanation

For sample 1, the canvas is 33 rows and 55 columns; the crop region is rows 22 to 22 and columns 22 to 44. This region contains only row 22, which is the string .>_<.; taking its columns 22 to 44 gives the substring >_<. So the program outputs >_<.

Constraints

For all test points, 1≤h,w≤1001 \le h, w \le 100, 1≤x1≤x2≤h1 \le x_1 \le x_2 \le h, 1≤y1≤y2≤w1 \le y_1 \le y_2 \le w.