//测试数据有两个地方需要主要 【1】.输入字符串长度超过10 【2】输入字符串含有空格。 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc= new Scanner(System.in); String s = sc.nextLine(); char[]c=s.toCharArray(); int zmnum=0;//字母 int shunum=0;// 数字 int elsenum=0;//其他 for (int i = 0; i < 10; i++) { if(c[i]>='0'&&c[i]<='9') shunum++; else if(c[i]>='a'&&c[i]<='z'||c[i]>='A'&&c[i]<='Z') zmnum++; else elsenum++; } System.out.println(zmnum+" "+shunum+" "+elsenum); } }
0.0分
0 人评分
校门外的树 (C++代码)浏览:870 |
点我有惊喜!你懂得!浏览:2072 |
C语言程序设计教程(第三版)课后习题10.7 (C语言代码)scanf后面加个getchar(),收掉回车符,就可以用gets了浏览:1149 |
【回文数(二)】 (C++代码)浏览:873 |
数组输出 (C语言代码)浏览:767 |
C二级辅导-公约公倍 (C语言代码)浏览:1510 |
C语言程序设计教程(第三版)课后习题6.1 (C语言代码)浏览:609 |
数组输出 (C语言代码)--此题的题目描述有问题浏览:1817 |
数组输出 (C语言代码)错误???浏览:566 |
成绩转换 (C语言代码)浏览:1008 |