monday.com interview question

I was asked to implement a string manipulation function