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语言程序设计教程(第三版)课后习题6.8 (C语言代码)浏览:706 |
永远的丰碑 (C语言代码)浏览:666 |
汽水瓶 (C语言代码)浏览:634 |
C语言程序设计教程(第三版)课后习题7.1 (C语言代码)浏览:532 |
C语言程序设计教程(第三版)课后习题6.10 (C语言代码)浏览:577 |
C二级辅导-阶乘数列 (C语言代码)浏览:720 |
众数问题 (C语言代码)浏览:869 |
WU-printf基础练习2 (C++代码)浏览:2026 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:583 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:628 |