-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAmusingjoke.java
More file actions
40 lines (37 loc) · 1.09 KB
/
Amusingjoke.java
File metadata and controls
40 lines (37 loc) · 1.09 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Amusingjoke {
public static void main(String[] args) throws Exception {
Scanner sc=new Scanner(System.in);
String a=sc.nextLine();
String b=sc.nextLine();
String s=sc.nextLine();
int x=a.length();
int y=b.length();
int z=s.length();
if(z!=x+y) System.out.println("NO");
else{
int[] arr=new int[26];
for(int i=0;i<x;i++){
arr[a.charAt(i)-'A']++;
}
for(int i=0;i<y;i++){
arr[b.charAt(i)-'A']++;
}
for(int i=0;i<z;i++){
arr[s.charAt(i)-'A']--;
if(arr[s.charAt(i)-'A']<0){
System.out.println("NO");return;
}
}
for(int i=0;i<26;i++){
if(arr[i]!=0){
System.out.println("NO");return;
}
}
System.out.println("YES");
}
}
}