Solved The Ninja Way ACM problem