Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Use of Dictionary solution in Clear category for Surjection Strings by mAzrunnr
def isometric_strings(a, b):
c = {}
x = range(len(a))
for i in x:
c[a[i]]= b[i]
d = ""
for i in x:
d = d + c.get(a[i])
return d == b
if __name__ == '__main__':
print("Example:")
print(isometric_strings('gogopyt', 'doodlee'))
# These "asserts" are used for self-checking and not for an auto-testing
assert isometric_strings('add', 'egg') == True
assert isometric_strings('foo', 'bar') == False
assert isometric_strings('', '') == True
assert isometric_strings('all', 'all') == True
assert isometric_strings('gogopy', 'doodle') == False
print("Coding complete? Click 'Check' to earn cool rewards!")
June 14, 2021