LearnPy Hub
← Arena
IntermediateRating 1200

Paint Bucket

Fill the region connected (up/down/left/right) to cell (r0, c0) — all cells with the same character — with the character X, and print the grid.

Input

r c, then r lines, then 'r0 c0' (0-based).

Output

The grid.

Sample 1

Input
3 3
aab
abb
bba
0 0
Output
XXb
Xbb
bba

Sample 2

Input
1 1
z
0 0
Output
X
solution.py
Output appears here
Paint Bucket · Python Arena problem · LearnPy Hub