-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11655.java
More file actions
32 lines (29 loc) · 884 Bytes
/
11655.java
File metadata and controls
32 lines (29 loc) · 884 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
// 11655. ROT13
// 2019.09.19
// 문자열 처리
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s = br.readLine();
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) >= 'a' && s.charAt(i) <= 'z') {
if (s.charAt(i) >= 'n' && s.charAt(i) <= 'z') {
System.out.print((char) (s.charAt(i) - 13));
} else {
System.out.print((char) (s.charAt(i) + 13));
}
} else if (s.charAt(i) >= 'A' && s.charAt(i) <= 'Z') {
if (s.charAt(i) >= 'N' && s.charAt(i) <= 'Z') {
System.out.print((char) (s.charAt(i) - 13));
} else {
System.out.print((char) (s.charAt(i) + 13));
}
} else {
System.out.print(s.charAt(i));
}
}
}
}