String is a subset of another string or not

In this program, we will take a string as input and check whether the string is a subset of another string or not.

Steps to solve the program
  1. Take a string and a substring as input.
  2. Convert the input string to a set using set() and assign it to the string3 variable.
  3. Create a count variable and assign its value equal to 0.
  4. Use for loop to iterate over string3, if a character from string3 exists in the substring then add 1 to the count variable every time.
  5. If the value of count variable is equal to the length of the substring then print True else False.

Output :

find duplicate characters in a string

sort a string

Leave a Comment