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++代码)(典型的约瑟夫环——链表解决)浏览:1203 |
简单编码 (C++代码)(这里推荐用switch)浏览:959 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:552 |
数组输出 (C语言代码)浏览:767 |
C语言程序设计教程(第三版)课后习题5.7 (C++代码)浏览:846 |
大小写转换 (C语言代码)浏览:839 |
C语言训练-求1+2!+3!+...+N!的和 (C语言代码)万恶的long long浏览:875 |
C二级辅导-阶乘数列 (C语言代码)浏览:688 |
WU-图形输出 (C++代码)浏览:800 |
1011题解浏览:760 |