problem: https://hack.codingblocks.com/app/contests/1975/931/problem
code: https://ide.codingblocks.com/s/406536
please check my code .I think my logic is correct and after printing the value of p I will reverse the value of p.
Please see the logic and correct it.