NTT DATA interview question

coding problem on string and one array problem