-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA141.java
47 lines (44 loc) · 1.36 KB
/
A141.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import java.util.Scanner;
public class A141 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int[] alpha = new int[26];
String str = scan.nextLine();
int total = str.length();
for (int i = 0; i < str.length(); i++) {
char ch = str.charAt(i);
int n = alphabets.indexOf(ch);
alpha[n]++;
}
str = scan.nextLine();
total = total + str.length();
for (int i = 0; i < str.length(); i++) {
char ch = str.charAt(i);
int n = alphabets.indexOf(ch);
alpha[n]++;
}
str = scan.nextLine();
if (total != str.length())
System.out.println("NO");
else {
int flag = 0;
int[] count = new int[26];
for (int i = 0; i < str.length(); i++) {
char ch = str.charAt(i);
int n = alphabets.indexOf(ch);
count[n]++;
}
for (int i = 0; i < 26; i++) {
if (alpha[i] != count[i]) {
flag = 1;
break;
}
}
if (flag == 1)
System.out.println("NO");
else
System.out.println("YES");
}
}
}