rewrite StonesGame using faster inputreader and outputwriter