HTMLTAGS - Editorial

maybe… but I use python 3 only…

At line 8 there’s a mistake, you should iterate i to c - 2 or more specifically (i < c - 1). Then it will get accepted.

@ssjgz yeah i didn’t considered the said test case in my code.
As pointed out by @prashant_th18 i corrected that .
Thank you both of you.

hi, actually this was right… i should have defined the flag earlier before use…
But as I was running on jupyter it must have taken the previous cell’s flag and so i didn’t get the error at my side… I corrected it now, and the issue is solved… thanks a lot!!

1 Like

Hello, can anyone please help me find the error in my code? https://www.codechef.com/viewsolution/48355586

1
<<a>
1 Like

Can you explain how regex work?? even some reference or video editorial would work??

thanks a lot its working now :slight_smile:

1 Like

My code

please debug it or gimme test cases

1
</>

https://www.codechef.com/viewsolution/48875405
Can someone help me to find the mistake in this solution ?

1 Like

And when you’ve fixed that:

#include<bits/stdc++.h>
#include
#include<string.h>
#define ll long long
using namespace std;
int main()
{
int t=1;
cin>>t;
while(t–)
{
string s;
cin>>s;
if(s[0]!=’<’)
{
cout<<“Error”<<endl;
continue;
}
if(s[s.length()-1]!=’>’)
{
cout<<“Error”<<endl;
continue;
}
if(s[1]!=’/’)
{
cout<<“Error”<<endl;
continue;
}
if(s.length()<=3)
{
cout<<“Error”<<endl;
continue;
}
bool res=true;
for(int i=2;i<s.length()-2;i++)
{
bool is_alpha=false;
bool is_digit=false;
if(int(s[i])>=97 && int(s[i])<=122)
{
is_alpha=true;
}
if(isdigit(s[i]))
{
is_digit=true;
}
if(!is_alpha && !is_digit)
{
res=false;
break;
}

    }
    if(res)
    {
        cout<<"Success\n";
    }
    else
    {
        cout<<"Error"<<endl;
    }
} 
return 0;

}

anyone please tell error