Getting Wrong Answer please help

Problem link-https://www.codechef.com/problems/SIMDISH
My solution link-https://www.codechef.com/viewsolution/15589680

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

example
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.