{"raw_statement":[{"iden":"problem statement","content":"We have a canvas represented as a grid with $H$ rows and $W$ columns. Let $(i, j)$ denote the square at the $i$\\-th row from the top $(1 \\leq i \\leq H)$ and $j$\\-th column from the left $(1 \\leq j \\leq W)$. Initially, $(i, j)$ is painted red if $s_{i, j}=$ `R` and blue if $s_{i, j}=$ `B`.\nFor any number of times, you can choose one of the two operations below and do it.\n\n> **Operation X:** Choose a square painted red, and repaint all squares in the row containing that square (including itself) white.  \n> **Operation Y:** Choose a square painted red, and repaint all squares in the column containing that square (including itself) white.\n\nShow one way that maximizes the number of squares painted white in the end."},{"iden":"constraints","content":"*   $1 \\leq H \\leq 2500$\n*   $1 \\leq W \\leq 2500$\n*   $s_{i, j}$ is `R` or `B`. $(1 \\leq i \\leq H, 1 \\leq j \\leq W)$\n*   $H$ and $W$ are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$H$ $W$\n$s_{1, 1}$$s_{1, 2}$$s_{1, 3}$$\\cdots$$s_{1, W}$\n$s_{2, 1}$$s_{2, 2}$$s_{2, 3}$$\\cdots$$s_{2, W}$\n$s_{3, 1}$$s_{3, 2}$$s_{3, 3}$$\\cdots$$s_{3, W}$\n $\\vdots$\n$s_{H, 1}$$s_{H, 2}$$s_{H, 3}$$\\cdots$$s_{H, W}$"},{"iden":"sample input 1","content":"4 4\nRBBB\nBBBB\nBBBB\nRBRB"},{"iden":"sample output 1","content":"3\nX 1 1\nY 4 3\nX 4 1\n\nHere is one sequence of operations that makes $10$ squares white:\n\n*   First, do **Operation X** choosing $(1, 1)$.\n*   Then, do **Operation Y** choosing $(4, 3)$.\n*   Then, do **Operation X** choosing $(4, 1)$.\n\nThere is no way to make $11$ or more squares white.\n![image](https://img.atcoder.jp/arc119/b0fde87f879b9dc90ca8788945f21bf2.png)"},{"iden":"sample input 2","content":"1 119\nBBBRBBBBBBRBBBBBBRBBBBBBRBBBBBBRBBBBBBRBBBBBBRBBBBBBRBBBBBBRBBBBBBRBBBBBBRBBBBBBRBBBBBBRBBBBBBRBBBBBBRBBBBBBRBBBBBBRBBB"},{"iden":"sample output 2","content":"4\nY 1 60\nY 1 109\nY 1 46\nX 1 11\n\nWe can repaint all squares white."},{"iden":"sample input 3","content":"10 10\nBBBBBBBBBB\nBBBBBBBBBB\nBBBBBBBBBB\nBBBBBBBBBB\nBBBBBBBBBB\nBBBBBBBBBB\nBBBBBBBBBB\nBBBBBBBBBB\nBBBBBBBBBB\nBBBBBBBBBB"},{"iden":"sample output 3","content":"0\n\nSince there is no red square, we cannot do the operations at all."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}