Genpact interview question

Simple program using list and string