My issue
My code
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
bool smilycount(int j, char arr[], int n)
{
if (arr[j] == ')')
{
smilycount(j + 1, arr, n);
}
else if (arr[j]=='(')
{
return false;
}
else
return true;
}
int main()
{
// your code goes here
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
char arr[n + 1];
for (int i = 0; i < n; i++)
{
cin >> arr[i];
}
int count = 0;
for(int j=0;j<n;j++)
{
if (arr[j] == ':')
{
if (smilycount(j, arr, n))
{
count++;
}
}
}
cout << count << endl;
}
return 0;
}
Problem Link: SMILEY Problem - CodeChef