Problem Statement | |||||||||||||
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'. Given a String[] words, return how many (unordered) pairs of words are isomorphic. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | words will contain between 2 and 50 elements, inclusive. | ||||||||||||
- | Each element of words will contain between 1 and 50 lowercase letters ('a'-'z'), inclusive. | ||||||||||||
- | All elements of words will have the same length. | ||||||||||||
- | There will be no duplicates in words. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
|