Back

21) array 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 my code is

Created 3 years ago
753 Views
4 Comments
kreetykishore
@kreetykishore
kreetykishore
@kreetykishoreProfile is locked. Login

S = input()

m = str(len(S) // 2)

x = S.replace(m, "*")

print(x)

it is showing error.

kindly provide the correct syntax

Comments (4)
Please login to comment.