-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask04.java
More file actions
33 lines (22 loc) · 803 Bytes
/
Task04.java
File metadata and controls
33 lines (22 loc) · 803 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
33
import java.util.Scanner;
public class Task04 {
public static String alpha = "abcdefghijklmnopqrstuvwxyz";
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int N = in.nextInt();
String x = in.nextLine();
for(int a=0; a<N; a++) {
String decrypt = in.nextLine();
String sol = "";
for(int i=0; i<decrypt.length(); i++) {
if(Character.toString(decrypt.charAt(i)).equals(" ")) sol += " ";
else sol += replace(Character.toString(decrypt.charAt(i)));
}
System.out.println(sol);
}
}
public static String replace(String a) {
int b = 25 - alpha.indexOf(a);
return Character.toString(alpha.charAt(b));
}
}