Microsoft interview question

A string comprehension codility question