program to print occurrence of each character in a string
Anonymous
Map result= new HashMap(); for(char ch:string.toCharArray()) { Integer I= result.get(ch); if(I == null) result.put(ch,1); else result.put(ch,I+1); }
Check out your Company Bowl for anonymous work chats.