Microsoft Interview Question

A string comprehension codility question