题目要求
解题思路
输出的时候为了方便就将char数组转换成string输出啦~
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
char[] x = in.next().toCharArray();
for (int i = 0; i < x.length; i++) {
if (x[i] >= 'A' && x[i] <= 'Z') {
x[i] += 32;
}
else {
x[i] -= 32;
}
}
System.out.println(String.valueOf(x));
}
}