Getting Wrong Answer please help

Problem link-
My solution link-

hello buddy…
tested your code .
problem is in cin.ignore() line
actually it is ignoring first of new test case’s first ingredient.

if my string is cupcake it will take as upcake
so remove the cin.ignore() fron inside the while and place it before while as we have to clear the instream only once for getline to work.