-
Notifications
You must be signed in to change notification settings - Fork 3
/
wertyu.java
71 lines (65 loc) · 1.99 KB
/
wertyu.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import java.io.*;
import java.util.*;
import java.math.*;
public class wertyu {
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in)/*new FileReader("input.txt")*/);
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
HashMap<Character, String> map = new HashMap<>();
//need to do something special for Q
map.put('1', "`");
map.put('2', "1");
map.put('3', "2");
map.put('4', "3");
map.put('5', "4");
map.put('6', "5");
map.put('7', "6");
map.put('8', "7");
map.put('9', "8");
map.put('0', "9");
map.put('-', "0");
map.put('=', "-");
map.put('W', "Q");
map.put('E', "W");
map.put('R', "E");
map.put('T', "R");
map.put('Y', "T");
map.put('U', "Y");
map.put('I', "U");
map.put('O', "I");
map.put('P', "O");
map.put('[', "P");
map.put(']', "[");
map.put('\\', "]");
map.put('S', "A");
map.put('D', "S");
map.put('F', "D");
map.put('G', "F");
map.put('H', "G");
map.put('J', "H");
map.put('K', "J");
map.put('L', "K");
map.put(';', "L");
map.put('\'', ";");
map.put('X', "Z");
map.put('C', "X");
map.put('V', "C");
map.put('B', "V");
map.put('N', "B");
map.put('M', "N");
map.put(',', "M");
map.put('.', ",");
map.put('/', ".");
String line = "";
while((line = in.readLine()) != null) {
for(int i = 0; i < line.length(); i++) {
char curr = line.charAt(i);
if(curr == 'Q') out.print("/t");
else if(curr == ' ') out.print(" ");
else out.print(map.get(curr));
}
out.println();
}
out.close();
}
}