SkiLLMarc DailyChallenge 03-07-2021:
Python Code:
fr=input().strip()
sr=input().strip()
tr=input().strip()
key=input().strip()
countf=counts=countt=tempf=temps=tempt=0
for i in key:
if( i in fr):
tempf+=1
temps=0
tempt=0
elif( i in sr):
tempf=0
temps+=1
tempt=0
elif( i in tr):
tempf=0
temps=0
tempt+=1
countf=max([countf,tempf])
counts=max([counts,temps])
countt=max([countt,tempt])
maxCount=max([countf,counts,countt])
if(maxCount==1):
print(-1)
else:
if(countf==maxCount):
print(fr)
if(counts==maxCount):
print(sr)
if(countt==maxCount):
print(tr)
Post a Comment