Share your repls and programming experiences

← Back to all posts
5.8. Strings: Reverse fragment
pole55 (307)

"Given a string in which the letter h occurs at least twice, reverse the sequence of characters enclosed between the first and last occurrences of it."

Example input:
In the hole in the ground there lived a hobbit

Example output:
In th a devil ereht dnuorg eht ni eloh ehobbit