import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
StringBuffer sb = new StringBuffer("");
String m = "";
while ((m=br.readLine())!=null) {
if (m.equals("")) {
sb.append("\n");
continue;
}
StringBuilder temp = new StringBuilder("");
if (m.charAt(0) >= '0' && m.charAt(0) <= '9') {
m = new StringBuilder(m).reverse().toString();
for (int i = 0; i < m.length();) {
StringBuilder temp2 = new StringBuilder("");
if (m.charAt(i) == '1') {
temp2.append(m.charAt(i)).append(m.charAt(i + 1)).append(m.charAt(i + 2));
i += 3;
} else {
temp2.append(m.charAt(i)).append(m.charAt(i + 1));
i += 2;
}
char c = (char) Integer.parseInt(temp2.toString());
temp.append((char)c);
}
} else {
for (int i = 0; i < m.length(); i++) {
if (m.charAt(i) == 32 || m.charAt(i) == 33 || m.charAt(i) == 44 || m.charAt(i) == 46
|| m.charAt(i) == 58 || m.charAt(i) == 59 || m.charAt(i) == 63) {
temp.append((int) m.charAt(i));
} else if (m.charAt(i) >= 'a' && m.charAt(i) <= 'z') {
temp.append((int) m.charAt(i));
} else if (m.charAt(i) >= 'A' && m.charAt(i) <= 'Z') {
temp.append((int) m.charAt(i));
}
}
}
if (m.charAt(0) >= '0' && m.charAt(0) <= '9') {
sb.append(temp);
} else {
sb.append(temp.reverse());
}
sb.append("\n");
}
System.out.print(sb);
}
}
No comments:
Post a Comment