靜態掃描儀sc =新掃描儀(system . in);
公共靜態void main(String[] args) {
地圖& ltInteger,Integer & gtmap = new HashMap & ltInteger,Integer & gt();
for(int I = 0;我& lt10;i++) {
map.put(i,0);
}
字符串s = null
while (true) {
system . out . println(" Please enter:");
s = sc . nextline();
if (Pattern.matches("^[0-9]*$),s){
打破;
}
}
char[]a = s . tochararray();
for (char cc:a) {
integer in = integer . parse int(cc+" ");
map.put(in,map . get(in)+1);
system . out . println(in);
}
system . out . println(map);
}
}