ABC interview question

2 coding rounds related array and string