解题思路: 循环判断,字符串连接
注意事项:
参考代码:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s =in.nextLine(),res=""; for(int i=0;i<s.length();i++) { char e =s.charAt(i); if(e>='A'&&e<='Y'||e>='a'&&e<='y') res+=(char)(e+1); else if(e=='z') res+="A"; else if(e=='Z') res+='a'; else res+=e; } System.out.println(res); in.close(); } }
0.0分
1 人评分