def isverb(s):
verbs=("hate","love","know","like","hates","loves","knows","likes");
if s in verbs:
return True
return False
def isarticle(s):
if s=='a' or s=='the':
return True
return False
def isnoun(s):
nouns=("tom","jerry","goofy","mickey","jimmy","dog","cat","mouse")
if s in nouns:
return True
return False
def calc(a,ver):
if len(a)>0 and isverb(a[len(a)-1]):
return False
if len(a)==0:
if ver==1:
return True
else:
return False
if len(a)==1 and isnoun(a[0]) and ver==1:
return True
if len(a)==2 and isarticle(a[0]) and isnoun(a[1]) and ver==1:
return True
i=0
flag=True
try:
if isnoun(a[i]):
if a[i+1]=='and':
flag=calc(a[i+2:],ver)
elif isverb(a[i+1]):
ver=1
flag=calc(a[i+2:],1)
else:
return False
elif isarticle(a[i]) and isnoun(a[i+1]):
if a[i+2]=='and':
flag=calc(a[i+3:],ver)
elif isverb(a[i+2]):
ver=1
flag=calc(a[i+3:],1)
else:
return False
else:
return False
except:
return False
if flag==True:
return True
else:
return False
def proc():
s=input().split(',')
for line in s:
if calc(line.strip().split(),0)==False:
return False
return True
def Main():
try:
while True:
if(proc()):
print("YES I WILL")
else:
print("NO I WON'T")
except:
return 0
if __name__=="__main__":
Main()
verbs=("hate","love","know","like","hates","loves","knows","likes");
if s in verbs:
return True
return False
def isarticle(s):
if s=='a' or s=='the':
return True
return False
def isnoun(s):
nouns=("tom","jerry","goofy","mickey","jimmy","dog","cat","mouse")
if s in nouns:
return True
return False
def calc(a,ver):
if len(a)>0 and isverb(a[len(a)-1]):
return False
if len(a)==0:
if ver==1:
return True
else:
return False
if len(a)==1 and isnoun(a[0]) and ver==1:
return True
if len(a)==2 and isarticle(a[0]) and isnoun(a[1]) and ver==1:
return True
i=0
flag=True
try:
if isnoun(a[i]):
if a[i+1]=='and':
flag=calc(a[i+2:],ver)
elif isverb(a[i+1]):
ver=1
flag=calc(a[i+2:],1)
else:
return False
elif isarticle(a[i]) and isnoun(a[i+1]):
if a[i+2]=='and':
flag=calc(a[i+3:],ver)
elif isverb(a[i+2]):
ver=1
flag=calc(a[i+3:],1)
else:
return False
else:
return False
except:
return False
if flag==True:
return True
else:
return False
def proc():
s=input().split(',')
for line in s:
if calc(line.strip().split(),0)==False:
return False
return True
def Main():
try:
while True:
if(proc()):
print("YES I WILL")
else:
print("NO I WON'T")
except:
return 0
if __name__=="__main__":
Main()
Comments
Post a Comment