蓝桥杯 算法训练 大小写转换 JAVA

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );
		char c[]  = br.readLine().toCharArray();
		for (int i = 0; i < c.length; i++) {
			if(c[i]>=65 && c[i]<=90){
				c[i]+=32;
			}else{
				c[i]-=32;
			}
		}
		System.out.println(new String(c));
		
	}
}

你可能感兴趣的:(蓝桥杯 算法训练 大小写转换 JAVA)