import java.io.*; public class Main { public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); public static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out)); public static StreamTokenizer cin = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); public static PrintWriter cout = new PrintWriter(new OutputStreamWriter(System.out)); public static void main(String[] args) throws Exception { String s = in.readLine(); char[] ch = s.toCharArray(); int a = 0, b = 0, c = 0, d = 0;// Java 需要初始化 for (int i = 0; i < ch.length; i++) { if ((ch[i] >= 'a' && ch[i] <= 'z') || (ch[i] >= 'A' && ch[i] <= 'Z')) { a++; } else if (ch[i] >= '0' && ch[i] <= '9') { b++; } else if (ch[i] == ' ') { c++; } else { d++; } } cout.printf("%d %d %d %d", a, b, c, d); cout.flush(); } }
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题11.3 (C语言代码)浏览:916 |
简洁的代码浏览:1474 |
C语言训练-数字母 (C语言代码)浏览:610 |
C语言程序设计教程(第三版)课后习题11.1 (C语言代码)浏览:686 |
兰顿蚂蚁 (C++代码)浏览:1225 |
printf基础练习2 (C语言代码)浏览:955 |
WU-复数求和 (C++代码)浏览:2119 |
C语言程序设计教程(第三版)课后习题6.11 (C语言代码)浏览:565 |
简单的for循环浏览:1497 |
2004年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:539 |