-
Notifications
You must be signed in to change notification settings - Fork 5
/
AmusingJoke.java
26 lines (24 loc) · 954 Bytes
/
AmusingJoke.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*https://codeforces.com/problemset/problem/141/A*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class AmusingJoke
{
public static void main(String[] args) throws IOException
{
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
int[] nameHash = new int[26], shuffleHash = new int[26];
String newYearMan = bufferedReader.readLine(), christmasMan = bufferedReader.readLine(), permutation = bufferedReader.readLine();
for (int i = 0; i < newYearMan.length(); ++i)
++nameHash[newYearMan.charAt(i)-'A'];
for (int i = 0; i < christmasMan.length(); ++i)
++nameHash[christmasMan.charAt(i)-'A'];
for (int i = 0; i < permutation.length(); ++i)
++shuffleHash[permutation.charAt(i)-'A'];
boolean result = true;
for (int i = 0; i < 26; ++i)
if (nameHash[i] != shuffleHash[i])
result = false;
System.out.println(result ? "YES" : "NO");
}
}