- import java.util.Scanner;
- public class JPA05{
- public static void main(String[] args) {
- Scanner s=new Scanner(System.in);
- String a=s.next();
- s.close();
- int first=a.charAt(0);
- if(a.length()==1){
- if(first>=48 && first<=57){
- first++;
- if(first==58){
- first=48;
- }
- }else if(first>=65 && first<=90){
- first+=33;
- }else if(first>=97 && first<=122){
- first-=31;
- }
- if((48<=first&&first<=57)||(66<=first&&first<=91)||(98<=first&&first<=123)){
- System.out.println((char)first);
- }else{
- System.out.println("error");
- }
- }else{
- if(first>=48 && first<=57){
- first++;
- if(first==58){
- first=48;
- }
- }else if(first>=65 && first<=90){
- first+=33;
- }else if(first>=97 && first<=122){
- first-=31;
- }
- int last = a.charAt(a.length()-1);
- if(last>=48 && last<=57){
- last++;
- if(last==58){
- last=48;
- }
- }else if(last>=65 && last<=90){
- last+=33;
- }else if(last>=97 && last<=122){
- last-=31;
- }
- if((48<=first&&first<=57)||(66<=first&&first<=91)||(98<=first&&first<=123)&&(48<=last&&last<=57)||(66<=last&&last<=91)||(98<=last&&last<=123)){
- System.out.println((char)first+a.substring(1,a.length()-1)+(char)last);
- }else{
- System.out.println("error");
- }
- }
- }
- }
複製代碼 |