B. [R4B]保留DMY

    Type: Default 1000ms 512MiB

[R4B]保留DMY

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

时空限制

1S/512M

题目描述

给定一个长度为 nn 的仅由大写英文字母构成的字符串 SS,删去其中除 DMY 之外的字符,将处理后的字符串输出。

如果 SS 中没出现这三种字符,输出 -1\text{-1}

格式

输入格式

第一行包含一个整数 nn,表示字符串 SS 的长度。

第二行包含一个长度为 nn 的仅由大写英文字母构成的字符串 SS

输出格式

如果 SS 中出现了 DMY 中的至少一种,将处理后的字符串输出;否则输出 -1\text{-1}

样例

样例输入 #1

12
DOMYHOMEWORK

样例输出 #1

DMYM

样例输入 #2

5
HELLO

样例输出 #2

-1

数据规模

对于 100%100\% 的数据,1n1061\leq n\leq10^6。数据保证 SS 仅由大写英文字母组成。

代码源挑战赛 Round 4

Not Attended
Status
Done
Rule
DMY
Problem
6
Start at
2025-3-21 20:00
End at
2025-3-21 21:30
Duration
1.5 hour(s)
Host
Partic.
461