Changing StringBuilder into HashMap and HashSet.