Ans=input()
AnsList=list(Ans)
while True:
Guess=input()
GusList=list(Guess)
A=B=0
for i in range(len(GusList)):
if GusList[i]==AnsList[i]:
A+=1
GusList[i]=""
elif GusList[i]!=AnsList[i] and GusList.count(AnsList[i])==1:
B+=1
else:
continue
if A==4:
print("%dA%dB" % (A,B))
print("You Win!")
break
else:
print("%dA%dB" % (A,B))