Getting wrong answer.Any Error in my code??

# Class Assignment

Hey @prashantverma.vn,

Your Output format is wrong.

In the sample output:

#1 : 2

#2 : 3

#3 : 5

The numbers after # specifies the number of iteration(or the ith test cases).

I have modified your code:

Give a like if you are satisfied.

#include<bits/stdc++.h>

using namespace std;

void compute(int n,string s,int &ans){

if(n==0){

ans++;

return;

}

if(n<0)

return;

compute(n-1,“a”+s,ans);

int x=s.length();

if(s[x-1]!=‘b’)

compute(n-1,“b”+s,ans);

return;

}

int main(){

int t;

cin>>t;

int i=1;

while(t–){

int n;

cin>>n;

int count=0;

compute(n,"",count);

cout<<"#"<<i++<<" : "<<count<<endl;

}

return 0;

}

Hey plz help me as well.

Every thing thing is fine here and also the output is matching so what is the error.

you are correct it works perfectly thanks for your help!!