Stack Implementation solution