Get common words from strings

In this program, we will take two strings as input and get common words from strings.

Steps to solve the program
  1. Take two strings as input and create an empty list.
  2. Using For loop find the common words from strings and add them to the empty list.
  3. Convert the list into a string Join().
  4. Print the output.
				
					#Input strings
string1 = "Very Good Morning, How are You"
string2 = "You are a Good student, keep it up"
List = []

for word in string1.split(" "):
    if word in string2.split(" "):
        List.append(word)

#Printing output        
" ".join(List)
				
			

Output :

				
					'Good are You'
				
			

find the longest capital letter word from the string.

find the smallest and largest word in a given string.

Leave a Comment