FindNRemoveSubstring

Write a program to remove the given word from the input string. If the substring is not present in the input string, then print the input string.
Input Format:
First-line consists of the sentence.
Second line consists of the words which we want to remove from the given sentence.
Output Format:
Sentence after the given word is removed.
Source Code
str1=input()
substr=input()
l=len(substr)
index=str1.find(substr)
if index!=-1:
    str1=str1[0:index]+str1[index+l:]
    print(str1)
else:
    print(str1)
Sample Input1:
Python is object oriented scripting language.
object oriented
Sample Output1:
Python is scripting language.
Sample Input2:
Python is object oriented scripting language.
programming
Sample Output2:
Python is object oriented scripting language.