// say S is some string; this counts the character frequencies in the string and puts it in a hashmap called map (I understand this part):
Map