Code not working on the site for HTMLTAGS

#include
#include
#include
#include <bits/stdc++.h>
using namespace std;
int main()
{

int tc;
int c;
cin >>tc;


while (tc--)
{
    c = 0;
    char str[100];
    cin >> str;
    int len = strlen(str);

    if (str[0] == '<' && str[1] == '/' && str[len - 1] == '>')
    {
        for (int i = 2; i < len - 1; i++)
        {
            if (str[i] >= 'a' && str[i] <= 'z' || str[i] >= '1' && str[i] <= '9')
            {
                c = 1;
            }
            else
            c=0;
        }
    }
    if (c == 1)
        cout << "Success" << endl;
    else
        cout << "Error" << endl;
}
return 0;

}

This solution for the HTMLTAGS problem is working on codeblocks as well as visual studio but its giving the SIGREV/SIGBART error when i try to submit it…Why is not working, and is there any issue with the code?

  char str[100];
        cin >> str;
1 Like

Your code is right but your not checking one important case that’s the length must be greater than 3. “</>” this input would come as success but it shouldn’t. It works perfectly for all other cases.

ok yes! i get it now…thankyou!

1 Like