-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEx 8.java
More file actions
32 lines (21 loc) · 715 Bytes
/
Ex 8.java
File metadata and controls
32 lines (21 loc) · 715 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.Scanner;
import java.util.Arrays;
import java.util.HashMap;
public class Main3 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String w1 = input.nextLine();
String w2 = input.nextLine();
char arr1[] = w1.toCharArray();
Arrays.sort(arr1);
char arr2[] = w2.toCharArray();
Arrays.sort(arr2);
String frst = new String(arr1);
String sec = new String(arr2);
HashMap< String,Integer> map = new HashMap< String, Integer>();
map.put(frst, 1);
map.put(sec,2);
if (map.size() == 1) System.out.print("true");
else System.out.print("false");
}
}