------解决方案-------------------- public static HashMap<Character,Integer> count(String str){
HashMap<Character,Integer> map=new HashMap<Character,Integer>();
for(int i=0;i<str.length();i++){
char ch=str.charAt(i);
Integer v=map.get(ch);
v=v==null?1:v+1;
map.put(ch, v);
}
return map;
}