Terralogic interview question

The coding question was from a string and can be solved using hashmap.