-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAmusingJoke.java
More file actions
32 lines (31 loc) · 944 Bytes
/
Copy pathAmusingJoke.java
File metadata and controls
32 lines (31 loc) · 944 Bytes
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
import java.util.Arrays;
import java.util.Scanner;
public class AmusingJoke {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
String name1=scanner.next();
String name2=scanner.next();
String pile=scanner.next();
String name=name1+name2;
if(name.length()!=pile.length()){
System.out.print("NO");
return;
}
int[] charNum=new int[26];
int[] pileNum=new int[26];
int length=name.length();
for(int i = 0; i < length; i++) {
charNum[name.codePointAt(i)-65]++;
pileNum[pile.codePointAt(i)-65]++;
}
/*for (int i = 0; i < 26; i++) {
System.out.println(charNum[i]+" "+pileNum[i]);
}*/
if(Arrays.equals(charNum,pileNum)){
System.out.print("YES");
}
else{
System.out.print("NO");
}
}
}