Question
We have a custom markup language, where each tag has a starting and ending tag. Starting tag may have attributes and values. We can call
We have a custom markup language, where each tag has a starting and ending tag. Starting tag may have attributes and values. We can call an attribute by referencing the tag, followed by a tilde, '~' and the name of the attribute.
The tags may also be nested. for e.g.
We can access a tag's attribute value: tag1~attribute1 for nested tag: tag1.tag2~attribute-name
It is given a tag starting will have an ending tag. The first line consists of two space separated integers, and . specifies the number of lines in the custom markup language.
Q specifies the number of queries. The following lines consist of either an opening tag with zero or more attributes or a closing tag. There is a space after the tag-name, attribute-name, '=' and value.There is no space after the last value. If there are no attributes there is no space after tag name. queries follow. Each query consists of string that references an attribute in the source program. More formally, each query is of the form: tagi1.tagi2tagin~attribute-name , n1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started