Terralogic Interview Question

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