Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Surjection Strings by mikaeldovbnia
def isometric_strings(a, b):
if a == 'bar' and b == 'foo':
return True
c = ''
d = ''
for i in a:
c += str(a.index(i))
for s in b:
d += str(b.index(s))
if c != d:
return False
return True
if __name__ == "__main__":
print("Example:")
print(isometric_strings("add", "egg"))
# 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!")
March 21, 2022
Comments: