Public Judge

pjudge

Time Limit: 1 s Memory Limit: 512 MB Total points: 100

#21790. 【NOIP Round #6】倒腾

الإحصائيات

题目描述

给定一个 $n\times m$ 的矩阵,每个位置可能为空也可能写了一个小写字母。

你需要维护 $q$ 次操作,操作分为四种:

  • D:重力方向向下,所有字母都向下落。换句话说,对于每一列,把这一列里的字母按原来的顺序排在最下方。
  • U:重力方向向上,所有字母都向上“落”。
  • L:重力方向向左,所有字母都向左“落”。
  • R:重力方向向右,所有字母都向右“落”。

如果原矩阵为

.a.b.c
aabb..
..ccdd

那么经过操作 L 之后会变成

abc...
aabb..
ccdd..

输出经过 $q$ 次操作之后矩阵的样子。

输入格式

第一行三个正整数 $n,m,q$ 。

第二行一个长度为 $q$ 的字符串,里面只包含 DULR 四种字符。

接下来 $n$ 行,每行一个长度为 $m$ 的字符串,里面只包含小写字母和 . ,表示矩阵的一行。

输出格式

输出 $n$ 行,每行一个长度为 $m$ 的字符串,里面只包含小写字母和 . ,表示最终的矩阵。

样例

样例输入

6 8 5
DLURD
k.l.ndi.
.....c..
......ih
j..a....
..cb....
..c...ef

样例输出

........
........
........
......hf
..iadice
.lkcbnjc

数据范围

对于 $30\%$ 的数据,保证 $1\le n,m,q\le 10$ 。

对于所有数据,保证 $1\le n,m,q\le 100$ 。

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.