Remove repeated characters in a string

In this program, we will take a string as input and remove repeated characters in a word of a string and replace it with a single letter.

Steps to solve the program
  1. Take a string as input.
  2. Remove the repeated characters in a string using set().
  3. Print the output.
				
					#Input string
str1 = "aabbccdd"

#Printing output
print("".join(set(str1)))
				
			

Output :

				
					cabd
				
			

swap cases of a given string

print a string 3 times

Leave a Comment