Isomorphic words and Implementaion in Java

Stagement

Two words are called isomorphic if the letters in one word can be remapped to get the second word. Remapping a letter means replacing all occurrences of it with another letter. The ordering of the letters remains unchanged. No two letters may map to the same letter, but a letter may map to itself.

For example, the words “abca” and “zbxz” are isomorphic because we can map ‘a’ to ‘z’, ‘b’ to ‘b’ and ‘c’ to ‘x’. But “foo” and “bar” are not isomorphic.

Analysis

We need to define a method which accepts a map & a value, and returns the value’s key in the map.

Java Solution