Can someone explain this question? (WORDGRID)

Can someone explain their own solution(code)?