解题思路:
注意事项:
参考代码:
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
//输入单词
String word = scanner.nextLine();
if (word.endsWith("er") || word.endsWith("ly") ) {
word = word.substring(0,word.length() - 2);
}else if(word.endsWith("ing")){
word=word.substring(0,word.length()-3);
}
//endsWith() 方法用于测试字符串是否以指定的后缀结束
//substring()方法用于截取字符串中的最后几个字符
System.out.println(word);
}
}
0.0分
0 人评分
2004年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:1341 |
1908题解浏览:640 |
1017题解浏览:605 |
1024题解浏览:809 |
简单的a+b (C语言代码)浏览:419 |
C二级辅导-分段函数 (C语言代码)浏览:601 |
企业奖金发放 (C语言代码)浏览:2325 |
孤独的骑士 (C语言代码)浏览:1370 |
龟兔赛跑预测 (C++代码)浏览:1183 |
A+B for Input-Output Practice (C语言代码)浏览:472 |