Remove duplicate words from the string.

In this program, we will take a string as input and remove duplicate words from the string.

Steps to solve the program
  1. Take a string as input.
  2. Convert the string into a list and create an empty list.
  3. Use for loop to iterate over every of the list.
  4. Add every of the list to the empty list, if a word repeats then do not add it to the empty list.
  5. Convert the new list into a string using join().
  6. Print the output.

Output :

create a string with a given list of words.

remove unwanted characters from the given string.

Leave a Comment