Publicis Sapient Interview Question

A question is asked to write the program which can be solved by using array of strings and loop concept