Google interview question

Exercise based on String manipulations