Playing with cards(in stack) (Challenges:Stack)

I am getting a wrong answer if i use more than 1 iteration.
here is the code that I have written.

u r taking input wrong as only n number are given as input and u r making a 2 loop for taking input
Also when the second iteration start u have to do works with those element which are not divided by ith prime number i.e ur stack 2nd.

I have modified the code. But I am still getting wrong answer for 1 test case and run error for another.

u have to change l for each iteration u are changing it for every elemnt
like there are 2 iteration
then in first l=1 primt no=2
then u do while(!s.empty()
and divide the number
then u hve to do l++ for second iteartion

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.