removed couts in dynamic solution