C - PC on the Table Editorial by evima

楽な実装

「指定した文字列または正規表現にマッチする全ての部分文字列を置換する」標準ライブラリ(C++ の regex_replace など)を使えば、公式解説の各行に対する処理が一度の関数呼び出しで完了します。

実装例(Python)

H, W = map(int, input().split())
for _ in range(H):
    print(input().replace('TT', 'PC'))

posted:
last update: