What is wrong in this?

Hello @kunaldude04,

  1. Correct your input format. It does not matches with that of the question.

  2. Add the following statements in your code:
    Note:
    Bool values are printed as 0 and 1.

if(ans)
    cout <<"true";
else
    cout<<"false"; 

Hope, this would help.
Give a like if you are satisfied.