Accenture interview question

Simple array and string based coding