#!/usr/bin/env python
# coding: utf-8

# In[7]:


s="google is great and twitter is also great"
l= s.split()
k=[]
for i in l:
    if (s.count(i)>1 and (i not in k)or s.count(i)==1):
        k.append(i)
    print(' '.join(k))


# In[ ]:





cc7e01cffc966458f47aea32b25be91217e347ca
<mask token>

<mask token>
for i in l:
    if s.count(i) > 1 and i not in k or s.count(i) == 1:
        k.append(i)
    print(' '.join(k))

s = 'google is great and twitter is also great'
l = s.split()
k = []
for i in l:
    if s.count(i) > 1 and i not in k or s.count(i) == 1:
        k.append(i)
    print(' '.join(k))

#!/usr/bin/env python
# coding: utf-8

# In[7]:


s="google is great and twitter is also great"
l= s.split()
k=[]
for i in l:
    if (s.count(i)>1 and (i not in k)or s.count(i)==1):
        k.append(i)
    print(' '.join(k))


# In[ ]:




