ABC Interview Question

2 coding rounds related array and string