-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdship.java
More file actions
47 lines (42 loc) · 1.46 KB
/
dship.java
File metadata and controls
47 lines (42 loc) · 1.46 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
41
42
43
44
45
46
47
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class dship {
public static void calc() throws IOException{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int input = Integer.parseInt(reader.readLine());
int i=0;
while(i<input){
int[] char1 = new int[26];
int[] char2 = new int[26];
String str1 = reader.readLine();
String str2 = reader.readLine();
if (str1.length()!=str2.length()){
System.out.println("Yes");
i++;
continue;
}
String alpha="abcdefghijklmnopqrstuvwxyz";
int j=0;
for(j=0;j<str1.length();j++){
int index1 = alpha.indexOf(str1.charAt(j));
int index2 = alpha.indexOf(str2.charAt(j));
char1[index1] = char1[index1]+1;
char2[index2] = char2[index2] + 1;
}
for(int e=0;e<26;e++){
if(char1[e]!=char2[e]){
System.out.println("Yes");
break;
}
if (e==25){
System.out.println("No");
}
}
i++;
}
}
public static void main(String[] args) throws IOException{
calc();
}
}