How I solved @onealfa 's third contest