Interview Question
- 0of 0 votes
AnswersAs a follow up to the Problem "XML Structure", given the input malformed XML String and the XML structure that it needs to follow, you need to find the well-formed XML String. You can assume that malformed XML string does follow the given structure and there is a unique well-formed XML String corresponding to it.
- saurabh March 31, 2012 in India
Input Format:
First line of input contains the structure of XML. Next line of input contains the malformed string.
Output Format:
Print in a single line the well-formed XML string.
Sample Input:
A B D C
<A><B></B><D><C></C></D><B><D></D></B></A>
Sample Output:
<A><B><D><C></C></D></B><B><D><C></C></D></B><B><D><C></C></D></B></A>
Note: You can attempt this problem without attempting XML Structure problem first, however you should read the problem XML Structure for proper background in order to solve this.
Constraints: There will be no more than 10,000 nodes.| Report Duplicate | Flag | PURGE