Google Interview Question

String manipulation and array multiplication