Answer to Question #308180 in Python for Kumar

Question #308180

Strict Sentence


A sentence is called Strict sentence if it contains all unique words.You can make a sentence strict by removing some words from it such that all remaining words are unique.


You are given a sentence S. You need to write a program to make it strict and print the longest strict sentence possible(Order of words in the given sentence should be preserved).


Note: Words are case-insensitive. For example, Apple, apple, aPPle etc.. are considered the same word.


Input

The first line contains a string S.


Output

The output contains a string which is the longest strict sentence possible.


Explanation

For S = my name is usha my native place is hyderabad.


my and is are not unique words.After removing my and is, the longest possible strict sentence is my name is usha native place hyderabad. So the output should be my name is usha native place hyderabad.


Sample Input1

my name is usha my native place is hyderabad

Sample Output1

my name is usha native place hyderabad


1
Expert's answer
2022-03-09T01:35:21-0500
input1 = input('')
l = input1.split()
list1 = []
for i in l:
    if (input1.count(i)>=1 and (i not in list1)):
        list1.append(i)
print(' '.join(k))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS