Playing with cars in Stack

why my code shows run error for first two test cases??
code link: https://ide.codingblocks.com/s/319246