标签:color oid scanner out string scan 形式 sys class
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String str = in.next(); //以字符串形式读取给定的数字 int[] count = {0,0,0,0,0,0,0,0,0,0,0}; //count数组:存储0~9这十个数字出现的次数 for(int i=0; i<str.length(); i++){ count[str.charAt(i) - ‘0‘]++; } for(int i=0; i<10; i++){ if (count[i] != 0) { System.out.println(i + ":" + count[i]); } } } }
标签:color oid scanner out string scan 形式 sys class
原文地址:https://www.cnblogs.com/Ymengchun/p/11111736.html