string A is "Tea is good for you", k is 3 then output should be "is good."
Here words "Tea", "for", "you" length is equal to 3, so these words are removed from string.
strin='Tea is good for you'
newStr=strin.split(' ')
new2=newStr[1]
new3=newStr[2]
joined=new2+' '+new3
k=input('enter the vaue of k= 3 \n')
if(int(k)==3):
print(joined)
if(int(k)==3):
text = strin.replace('is good', "\b")
print("\nNew String without \"" + joined + "\":")
print(text)
else:
print("\n\"" + joined + "\" is not found in the string!")
Output: