Deloitte interview question

Coding for looping Coding for replace character