s = str(input("Enter a String which are duplicates Words \n "))

l = s.split() 

k = [] 

for i in l: 

  

    # If condition is used to store unique string  

    # in another list 'k'  

    if (s.count(i)>1 and (i not in k)or s.count(i)==1): 

        k.append(i) 

print(' '.join(k)) 

0 Comments:

Post a Comment



Older Post Home

Blogger Template by Blogcrowds.