Advertisement
Guest User

Untitled

a guest
Feb 1st, 2015
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. key = open('key.txt', 'r').read()
  2. mat = open('init.txt', 'r').read().replace('\n', '')
  3.  
  4. choices = list({c for c in key} - {c for c in mat})
  5.  
  6. newmat = ''
  7. for c in mat:
  8.     if not c in newmat:
  9.         newmat += c
  10.     else:
  11.         repl = choices[0]
  12.         choices.remove(repl)
  13.         newmat += repl
  14.  
  15. open('output.txt', 'w').write('\n'.join([newmat[i:i + 5] for i in range(0, 25, 5)]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement