Here is the problem I am trying to solve but having trouble solving:
Define a function called repeat_middle
which receives as parameter one string (with at least one character), and it should return a new string which will have the middle character/s in the string repeated as many times as the length of the input (original) string. Notice that if the original string has an odd number of characters there is only one middle character. If, on the other hand, if the original string has an even number of characters then there will be two middle characters, and both have to be repeated (see the example).
Additionally, if there is only one middle character, then the string should be surrounded by 1 exclamation sign in each extreme . If, on the other hand, the original string has two middle characters then the output (or returned) string should have two exclamation signs at each extreme.
As an example, the following code fragment:
print repeat_middle("abMNcd")`
should produce the output:
!!MNMNMNMNMNMN!!