Google Interview Question

Related to strings and lists