May I know where I have done a mistake ? please let me know

HTML Tags question
May I know where I have done a mistake ? please let me know
#include

using namespace std;

int main()
{
int t;
cin>>t;
while(t–)
{
string s;
bool fail=false;
cin>>s;
int k=s.length();
if(k>3)
{
if(s[0]==’<’ and s[1]==’/’ and s[k-1]==’>’)
{
for(int i=2;i<k-1;i++)
{
if(islower(s[i])||isdigit(s[i]))
fail=false;
else
{
fail=true;
break;
}
}
}
else
{
fail=true;
break;
}
}
else
{
fail=true;
break;
}
if(fail==true)
cout<<“Error”<<endl;
else
cout<<“Success”<<endl;

}

return 0;

}

Hey @soujan_123 :wave:
Your Logic is correct but you had added break statement in the else which is breaking you out from the while loop.

1 Like

Can I obtain the output if I remove the break in else ?

your while loop will stop after showing “Success” in testcase

Thank you so much got it…