Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Surjection Strings by Gary_M_Lau
import string
def isometric_strings(str1, str2):
char_dict = {}
for i in range(len(str1)):
try:
# check if char already used but doesn't match with current linkage
if char_dict[str1[i]] != str2[i]:
return False
# if char haven't been used then add the linkage to dict
except KeyError:
char_dict[str1[i]] = str2[i]
return True
Sept. 26, 2020