se=input('Enter the sentence:')
n=len(se)
c=0
es=''
es1=''
L=[]
for i in se:
es1=es1+i
if i.isspace():
if es==es1:
c=c+1
L.append(es1)
es=''
es1=''
else:
es=i+es
print('Palindrome words in your sentence are:-',L,'\nNumber of palindrome words are',c)
se=input('Enter the sentence:')
n=len(se)
c=0
es=''
es1=''
L=[]
for i in se:
es1=es1+i
if i.isspace():
if es==es1:
c=c+1
L.append(es1)
es=''
es1=''
else:
es=i+es
print('Palindrome words in your sentence are:-',L,'\nNumber of palindrome words are',c)
Comments
Post a Comment