CF141A.Amusing Joke

入门

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

So, the New Year holidays are over. Santa Claus and his colleagues can take a rest and have guests at last. When two "New Year and Christmas Men" meet, thear assistants cut out of cardboard the letters from the guest's name and the host's name in honor of this event. Then the hung the letters above the main entrance. One night, when everyone went to bed, someone took all the letters of our characters' names. Then he may have shuffled the letters and put them in one pile in front of the door.

The next morning it was impossible to find the culprit who had made the disorder. But everybody wondered whether it is possible to restore the names of the host and his guests from the letters lying at the door? That is, we need to verify that there are no extra letters, and that nobody will need to cut more letters.

Help the "New Year and Christmas Men" and their friends to cope with this problem. You are given both inscriptions that hung over the front door the previous night, and a pile of letters that were found at the front door next morning.

新年假期结束了,圣诞老人和他的同事们终于可以休息一下,并接待客人了。当两位“新年与圣诞老人”相遇时,他们的助手会为了庆祝这一盛事,用硬纸板剪出客人姓名和主人姓名中的所有字母,然后将这些字母悬挂在正门上方。

然而就在某天夜里,当所有人都已入睡时,有人拿走了我们角色姓名中的全部字母。随后,他可能将这些字母打乱顺序,并把它们堆在了门口前方。

第二天清晨,人们已无法找出制造这场混乱的罪魁祸首。但大家不禁疑惑:能否仅凭散落在门口的这些字母,还原出主人及其客人的姓名?换言之,我们需要验证:这些字母中既没有多余的字母,也无需额外剪裁更多字母。

请帮助“新年与圣诞老人”及其朋友们解决这一问题。你将获得昨夜悬挂在正门前的两段文字(即主人名与客人名),以及今晨在正门前发现的一堆字母。

输入格式

The input file consists of three lines: the first line contains the guest's name, the second line contains the name of the residence host and the third line contains letters in a pile that were found at the door in the morning. All lines are not empty and contain only uppercase Latin letters. The length of each line does not exceed 100.

输入文件包含三行:第一行是客人的姓名,第二行是住所主人的姓名,第三行是早晨在门口发现的一堆字母。所有行均非空,且仅包含大写拉丁字母。每行的长度不超过 100。

输出格式

Print "YES" without the quotes, if the letters in the pile could be permuted to make the names of the "New Year and Christmas Men". Otherwise, print "NO" without the quotes.

如果堆中的字母可以重新排列,组成“New Year and Christmas Men”的名字,则输出不带引号的 "YES";否则,输出不带引号的 "NO"。

输入输出样例

  • 输入#1

    SANTACLAUS
    DEDMOROZ
    SANTAMOROZDEDCLAUS

    输出#1

    YES
  • 输入#2

    PAPAINOEL
    JOULUPUKKI
    JOULNAPAOILELUPUKKI

    输出#2

    NO
  • 输入#3

    BABBONATALE
    FATHERCHRISTMAS
    BABCHRISTMASBONATALLEFATHER

    输出#3

    NO

说明/提示

In the first sample the letters written in the last line can be used to write the names and there won't be any extra letters left.

In the second sample letter "P" is missing from the pile and there's an extra letter "L".

In the third sample there's an extra letter "L".

在第一个样例中,最后一行写出的字母恰好可以拼出所有名字,且没有剩余字母。

在第二个样例中,堆中缺少字母 “P”,且多出一个字母 “L”。

在第三个样例中,多出一个字母 “L”。

输入解题思路,AI测评打分。不知道怎么写?

首页