Light Oj Solutions: 1000 – Greetings from LightOJ

Problem link: http://www.lightoj.com/volume_showproblem.php?problem=1000

Solution:
This is a EOF related problem.