T - Amusing Joke

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了T - Amusing Joke相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/rip' title='rip'>rip   tput   rdb   tle   main   flag   sbo   ssis   pil   

Problem description

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鈥榮 name and the host鈥榮 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.

Input

The input file consists of three lines: the first line contains the guest鈥榮 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.

Output

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.

Examples

Input
SANTACLAUS
DEDMOROZ
SANTAMOROZDEDCLAUS
Output
YES
Input
PAPAINOEL
JOULUPUKKI
JOULNAPAOILELUPUKKI
Output
NO
Input
BABBONATALE
FATHERCHRISTMAS
BABCHRISTMASBONATALLEFATHER
Output
NO

Note

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

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

In the third sample there鈥榮 an extra letter "L".

瑙i鎬濊矾锛氶鐩殑鎰忔€濆氨鏄皢绗竴琛屽瓧绗︿覆鍜岀浜岃鐨勫瓧绗︿覆涓殑瀛楁瘝闅忔満鎵撲贡椤哄簭骞朵笖鎷兼帴璧锋潵鍜岀涓夎鐨勫瓧绗︿覆姣旇緝锛屽鏋滅涓夎鐨勫瓧绗︿覆鍒氬ソ涓哄墠涓よ瀛楃涓蹭腑鐨勫瓧姣嶇粍鎴愶紝鍒欒緭鍑?YES"锛屽惁鍒欒緭鍑?NO"銆傚仛娉曪細閲囩敤map瀹瑰櫒锛岄敭涓哄瓧姣嶅簭鍙凤紝鍊间负璇ュ瓧姣嶅嚭鐜扮殑娆℃暟锛屽鏋滃墠涓よ姣忎釜瀛楁瘝鍑虹幇鐨勬鏁板拰绗笁琛屽搴斿瓧姣嶅嚭鐜扮殑娆℃暟閮界浉鍚岋紝鍒欒緭鍑?YES"锛屽惁鍒欒緭鍑?NO"锛屾按杩囥€?/span>

AC浠g爜锛?/span>

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 int main(){
 4     map<int,int> mp1,mp2;
 5     for(int i=0;i<26;++i)mp1[i]=mp2[i]=0;
 6     char s1[105],s2[105],s3[105];
 7     cin>>s1>>s2>>s3;
 8     for(int i=0;s1[i]!=鈥?/span>鈥?/span>;++i)mp1[s1[i]-鈥?/span>A鈥?/span>]++;
 9     for(int i=0;s2[i]!=鈥?/span>鈥?/span>;++i)mp1[s2[i]-鈥?/span>A鈥?/span>]++;
10     for(int i=0;s3[i]!=鈥?/span>鈥?/span>;++i)mp2[s3[i]-鈥?/span>A鈥?/span>]++;
11     bool flag=false;
12     for(int i=0;i<26;++i)
13         if(mp1[i]!=mp2[i]){flag=true;break;}
14     if(flag)cout<<"NO"<<endl;
15     else cout<<"YES"<<endl;
16     return 0;
17 }

 







以上是关于T - Amusing Joke的主要内容,如果未能解决你的问题,请参考以下文章

HDU 4969 Just a Joke(积分)

joke python

BZOJ 1816 扑克牌(二分)

ZCMU Problem A: Good Joke!

[HDU4969]Just a Joke

springcloud报错-------关于 hystrix 的异常 FallbackDefinitionException:fallback method wasn't found(代码片段