what is wrong in my approach?
#include<bits/stdc++.h>
using namespace std;
void func(int left,int right,string s)
{
if(left==0 && right==0)
cout<<s<<endl;
if(left >0)
func(left-1,right,s+"(");
if(left < right)
func(left,right-1,s+")");
}
int main()
{
int n;
cin>>n;
string s="";
func(n,n,s);
}