Mr.BG is very busy person. So you have been given enough time (1000 milliseconds) to help him. Mr. BG has a bag of marbles with different alphabets written on them. And he has become busy on playing with these marbles by putting them in N boxes place…