PwC interview question

program based on Collection.