Given a string S, print it after changing the middle element to (if the length of the string is even, change the 2 middle elements to ).
Sample Testcase :
INPUT
hello
OUTPUT
he*lo
S = input()
d = len(S)//2
if len(S)%2 == 1:
print(S[0:d]+'*'+S[d+1:])
else:
print(S[0:d-1]+'*'+S[d+1:])
I am getting private test case1 pass but private test case2 failed I didn't get correct output. Anyone can explain it.