Company: Google
Difficulty: medium
Count Isomorphic You are given a list of N strings consisting of only lowercase letters. S[i] represents the i th string in the list. Task You are given Q queries. For each query, you are given a string K[i]. Determine the count of strings that are present in the list of strings such that they are isomorphic to K[i]. Notes Two strings, X and Y, are called isomorphic if all occurrences of each character in X can be replaced with another character to get Y and vice-versa. For example, consider strings \"ACAB\" and \"XCXY\". They are isomorphic as you can map \'A\' to \'X\', \'B\' to \'Y\', and \'C\' to \'C\', to get the string \"XCXY\" from \"ACAB\". The mapping from a character to itself is allowed, but the same character cannot replace two characters. Example Assumptions: N = 4 Q = 1 S = [\"abaca\", \"efefe\", \"trtft\", \"rtrcr\"] K = [\"hwhoh\"] Approach: \"abaca\", \"trtft\", \"rtrcr\" are isomorphic to \"hwhoh\". \"abaca\" is isomorphic to \"hwhoh\" if you map \'a\' to \'h\', \'b\'