HackerEarth Foo and Exams problem solution - TheCScience