recursive soulution to reverse stack