HTML TagsProblem code: TECH10 |
Given an HTML text and a tag, remove the tag along with its contents. The input text would be properly formatted with each tag having an appropriate end tag at the right position.
Input
The first line would contain the number of test cases T. Each of the next T lines (T <= 30) would contain one test case consisting of two inputs, text and tag, formatted as "{text},tag". The input text will contain at least one non - whitespace character. Maximum length = 100.
Output
Print T lines, one corresponding to each test case, containing the required answer.
Example
Input:
2
{<p>this is outside the tag given <algocrack> this is inside the tag</algocrack></p>},algocrack
{again this is outside the tag,<tag>there <tag> can be any</tag> data here</tag>},tag
Output:
<p>this is outside the tag given </p>
again this is outside the tag,
Notes and Constraints: (All quotes for clarity only)
1. The input would consist of only lowercase letters, numbers and spaces.
2. '}' will always be followed by a ','
3. For this problem, anything which is in between '<' and '>' is a valid HTML tag.
4. Extra white spaces would be ignored ie "abc ghi" is same as "abc ghi", but not the same as "abcghi"
5. If the resulting text after removing the tags does not contain any text, print "NO TEXT"
| Author: | technovanza10 |
| Date Added: | 17-01-2010 |
| Time Limit: | 1 sec |
| Source Limit: | 50000 Bytes |
| Languages: | C, C99 strict, CLOJ, CPP 4.0.0-8, CPP 4.3.2, F#, GO, JAVA, PERL6, PYTH 3.1.2, TEXT |
Comments

Fetching successful submissions
