-
-
Save glassus/903168b901c0246ed7f4b03b292b4c46 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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