Skip to content

Instantly share code, notes, and snippets.

@glassus
Created March 29, 2022 11:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glassus/903168b901c0246ed7f4b03b292b4c46 to your computer and use it in GitHub Desktop.
Save glassus/903168b901c0246ed7f4b03b292b4c46 to your computer and use it in GitHub Desktop.
def compare(prop, sol):
n = len(prop)
sol = list(sol)
ver = ['_']*n
for i in range(n):
if prop[i] == sol[i]:
ver[i] = 'R'
sol[i] = '_'
for i in range(n):
if prop[i] in sol:
ver[i] = 'J'
k = sol.index(prop[i])
sol[k] = '_'
print(prop)
print("".join(l for l in ver))
compare("MANOIR", "MAISON")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment