5.7. Strings: Remove fragment
"Given a string in which the letter h occurs at least twice. Remove from that string the first and the last occurrence of the letter h, as well as all the characters between them."
"Given a string in which the letter h occurs at least twice. Remove from that string the first and the last occurrence of the letter h, as well as all the characters between them."
Mine code is realy bad:
s = input()
if s.find('h') == 0:
print((s[s.rfind('h') + 1:]))
else:
print(str(s[0:s.find('h') - 1]) + str(s[s.find('h') - 1])+str(s[s.rfind('h') + 1:]))
i was looking for other people their solution why do i make everyting so complicated