Google interview question

both were string manupulation questions