import re
n=input("Enter a String:")
# Replace the String based on the pattern
replacedText = re.sub('[%]+','$', n,1)
# Print the replaced string
print("Replaced Text:",replacedText)
input I have given is:
ro%hi%
Output:
ro$hi%
I want to change the second % in the String with empty space(''). Is it possible. For that what changes can I do in my code.