String str="abceddfdsaaadcr";
Map<String,Integer> map=new HashMap<String,Integer>();
Integer count = 0;
for(int i=0;i<str.length();i++){
if(!map.containsKey(""+str.charAt(i))){
map.put(""+str.charAt(i), 1);
}else{
Integer in= map.get(""+str.charAt(i));
map.put(""+str.charAt(i), in+1) ;
}
}
System.out.println(map);
}
Map<String,Integer> map=new HashMap<String,Integer>();
Integer count = 0;
for(int i=0;i<str.length();i++){
if(!map.containsKey(""+str.charAt(i))){
map.put(""+str.charAt(i), 1);
}else{
Integer in= map.get(""+str.charAt(i));
map.put(""+str.charAt(i), in+1) ;
}
}
System.out.println(map);
}