import os
import sys
sought = sys.argv[1]
replace = sys.argv[2]
source = sys.argv[3]
f = open(source, "w")
while True:
line = f.readline()
resultFind = line.find(sought)
if not resultFind == -1:
resultFind += len(sought) - 1
line = replace + line[resultFind : 0]
f.writelines(line)
print("ok")
f.close()
aW1wb3J0IG9zCmltcG9ydCBzeXMKCnNvdWdodCA9IHN5cy5hcmd2WzFdCnJlcGxhY2UgPSBzeXMuYXJndlsyXQpzb3VyY2UgPSBzeXMuYXJndlszXQoKZiA9IG9wZW4oc291cmNlLCAidyIpCgp3aGlsZSBUcnVlOgogICAgbGluZSA9IGYucmVhZGxpbmUoKQogICAgcmVzdWx0RmluZCA9IGxpbmUuZmluZChzb3VnaHQpCgogICAgaWYgbm90IHJlc3VsdEZpbmQgPT0gLTE6CiAgICAgICAgcmVzdWx0RmluZCArPSBsZW4oc291Z2h0KSAtIDEKICAgICAgICBsaW5lID0gcmVwbGFjZSArIGxpbmVbcmVzdWx0RmluZCA6IDBdCiAgICAgICAgZi53cml0ZWxpbmVzKGxpbmUpCiAgICAgICAgcHJpbnQoIm9rIikKCmYuY2xvc2UoKQ==