Iam going thru a past exam paper and Iam a bit stuck, how can I solve this one:

In this question you have to write the body of a function:
A string of even length is sent to function changedString where firstly all occurrences of the
substring
es
in the first half of the string have to be deleted (erased),
secondly all occurrences of the substring
es
in the second half of the string...