import java.util.Scanner; //抄别人的 public class Main{ public static void main(String[] age){ Scanner in=new Scanner(System.in); int word = 0, number = 0, space = 0, others = 0; String ch=in.nextLine(); for(int i=0;i<ch.length();i++){ char c=ch.charAt(i);//依次取出每个字母 if ('a' <= c && c <= 'z' || 'A' <= c && c <= 'Z') { word++; } else if ('0' <= c && c <= '9') { number++; } else if (c == ' ') { space++; } else { others++; } }System.out.println(word+" "+number+" "+space+" "+others); } }
0.0分
1 人评分
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:557 |
printf基础练习2 (有点不明白)浏览:807 |
C语言程序设计教程(第三版)课后习题7.1 (C语言代码)浏览:588 |
Hello, world! (C++代码)浏览:1719 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:676 |
字符逆序 (C语言代码)浏览:607 |
复数求和 (C语言代码)浏览:901 |
格式化数据输出 (C语言代码)浏览:791 |
筛排处理 (C语言代码)浏览:753 |
2003年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:798 |