2021级 |
您所在的位置:网站首页 › hello航天员 › 2021级 |
7-1 sdut-String-3 字符串字母大小写转换逆序输出
编写程序,实现字符串中的字符大小写转换,并逆序输出。 输入格式:输入一行字符串。 输出格式:对字符串中的字母进行大小写转换,其余字符不变化,最后对字符串逆序输出。 输入样例1: Hello World! 输出样例1: !DLROw OLLEh 输入样例2: 12312kfakfaskakdsfjSDFDFFSFDSFSF123 afdkadsfk@ 输出样例2: @KFSDAKDFA 321fsfsdfsffdfdsJ import java.util. *; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.nextLine(); int n = s.length(); for(int i = n - 1; i >= 0; i --) { char c = s.charAt(i); if(c >= 'A' && c = 'a' && c = 0; i --) { char c = s.charAt(i); if(c >= '0' && c = '0' && c |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |