atcoder#ABC297C. [ABC297C] PC on the Table

[ABC297C] PC on the Table

Score : 300300 points

Problem Statement

Planning to place many PCs in his room, Takahashi has decided to write a code that finds how many PCs he can place in his room.

You are given HH strings S1,S2,,SHS_1,S_2,\ldots,S_H, each of length WW, consisting of . and T.

Takahashi may perform the following operation any number of times (possibly zero):

  • Choose integers satisfying 1iH1\leq i \leq H and 1jW11 \leq j \leq W-1 such that the jj-th and (j+1)(j+1)-th characters of SiS_i are both T. Replace the jj-th character of SiS_i with P, and (j+1)(j+1)-th with C.

He tries to maximize the number of times he performs the operation. Find possible resulting S1,S2,,SHS_1,S_2,\ldots,S_H.

Constraints

  • 1H1001\leq H \leq 100
  • 2W1002\leq W \leq 100
  • HH and WW are integers.
  • SiS_i is a string of length WW consisting of . and T.

Input

The input is given from Standard Input in the following format:

HH WW

S1S_1

S2S_2

\vdots

SHS_H

Output

Print a sequence of strings, S1,S2,,SHS_1,S_2,\ldots,S_H, separated by newlines, possibly resulting from maximizing the number of times he performs the operation.

If multiple solutions exist, print any of them.

2 3
TTT
T.T
PCT
T.T

He can perform the operation at most once.

For example, an operation with (i,j)=(1,1)(i,j)=(1,1) makes S1S_1 PCT.

3 5
TTT..
.TTT.
TTTTT
PCT..
.PCT.
PCTPC