We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c84951c commit 997306eCopy full SHA for 997306e
1 file changed
BasicLevel_Java/1021. 个位数统计 (15).java
@@ -0,0 +1,19 @@
1
+import java.io.BufferedReader;
2
+import java.io.IOException;
3
+import java.io.InputStreamReader;
4
+
5
+public class Main {
6
+ public static void main(String[] args) throws IOException {
7
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
8
+ char[] chars = br.readLine().toCharArray();
9
+ int[] count = new int[11];
10
+ for (int i = 0; i < chars.length; i++) {
11
+ count[chars[i] - '0']++;
12
+ }
13
+ for (int i = 0; i < 11; i++) {
14
+ if (count[i] != 0) {
15
+ System.out.println(i + ":" + count[i]);
16
17
18
19
+}
0 commit comments