Do You Know Your ABCs? Silver

Link

What type of problem is this? Is this Ad-Hoc or math?

Ad Hoc.