解题思路:
注意事项:
参考代码:
import java.util.Scanner;
public class 单词翻转 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s=sc.nextLine();
String [] s1=s.split(" ");
for (int i = 0; i < s1.length; i++) {
for (int j = 0; j < s1[i].length(); j++) {
System.out.print(s1[i].charAt(s1[i].length()-1-j));
}
if (i==s1.length-1){ //防止最后一个单词的后面多出一个空格
}else {
System.out.print(" ");
}
}
}
}
0.0分
0 人评分
C二级辅导-进制转换 (C语言代码)浏览:615 |
C语言训练-求1+2!+3!+...+N!的和 (C语言代码)浏览:542 |
简单的a+b (C语言代码)浏览:530 |
A+B for Input-Output Practice (II) (C语言代码)浏览:999 |
C语言训练-求PI* (C语言代码)浏览:614 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:327 |
A+B for Input-Output Practice (III) (C语言代码)浏览:569 |
矩阵乘方 (C语言代码)浏览:1031 |
罗列完美数 (C语言代码)浏览:491 |
printf基础练习2 (C语言代码)浏览:508 |