Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- input=open("input.txt",'r')
- output=open("output.txt",'w')
- q=input.readline()
- q=int(q)
- d=set()
- s=str()
- for i in range(q):
- num=0
- s=input.readline()
- if s[1]=="?":
- while s not in d:
- if num<10:
- s=s[0]+"0"+str(num)+s[3:]
- else:
- s=s[0]+str(num)+s[3:]
- if s not in d:
- d.add(s)
- break
- num += 1
- if num==100:
- output.write("NO\n")
- exit()
- elif s in d :
- output.write("NO\n")
- exit()
- else:
- d.add(s)
- s=str()
- output.write("YES\n")
- for i in d:
- output.write(i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement