Replace all occurrences of a string with space | Function to extract the secret message ; Replacing all occurrences of Sub in Str by empty spaces ; Removing unwanted spaces in the start and end of the string ; Driver code
def extractSecretMessage ( Str , Sub ) : NEW_LINE INDENT Str = Str . replace ( Sub , " ▁ " ) NEW_LINE return Str . strip ( ) NEW_LINE DEDENT Str = " LIELIEILIEAMLIECOOL " NEW_LINE Sub = " LIE " NEW_LINE print ( extractSecretMessage ( Str , Sub ) ) NEW_LINE