URI Online Judge | 2684

Help Professor Webscript!!

By Samuel Lucas Santos Gomes, IFSULDEMINAS BR Brazil

Timelimit: 1

Professor Webscript, one of the renowned professors at the Federal Institute of Muzambinho teaches his students to develop fully responsive and practical websites without the need for frameworks. It assists the most diverse types of students across the school, but tired of teaching the correct syntax of the tags (">" close and "<" opens) correctly. So, to get back the peace and tranquility that he had, he asks for your help.

There will be several types of tags, there is no need to text the tags, your program should indicate if a tag was used correctly or not. Do not forget that your program should follow some criteria as in the example below.

I - The first parameter indicates the type of the tag:
1 - When the tag is unique.
0 - When the tag has two pairs of signals;

II - Signals such as ">" or "<" should only be used to indicate the closing or opening of a tag:
0 <p> Home> Download> Sublime </ p> -> error
1 <input type = "text" name = "Next>"> -> error
0 <ul> <li> Ola </ li> </ ul> -> Successful
1 <span> <br> -> right
0 <> </ li> -> error

When we enter the parameter, there are only tags of the chosen pattern, for example: if we put 0 (When the tag has two pairs of signals) the program will only check tags with two pairs of signals, the same thing happens when we put 1 tag is unique). So in a single tag there will not be both types.
 

Input

The entry contains an integer 0 < N < 100 that indicates the number of situations to check. The next N lines correspond to the situations, each with an integer K (0 or 1) (which will be the means of identifying the tag (s)), and then a line with the S code (0> S <200) to be verified.

Output

As in the given example, make sure the tag was used correctly. Your program should report "Successful !!" if the syntax is right or "error" if something is missing. The message should be displayed without the quotation marks, with the line break at the end.

Input Sample Output Sample

5
1 <meta charset="UTF-8">
0 <p> Home>Download>Sublime </p> 
1 <input type="text" name="Next >">
0 <li><a href=""></a></li>
1 <meta charset="UTF-8"><li></li>

Successful!!
error
error
Successful!!
error