code functionality change- counting each character occurence