Hard
Stacking Tag Decorators
Write a factory
tag(name) that wraps a result in <name>…</name>. Read tag names on the first line; apply them so that the first name is the outermost, to a function returning the text from the second line, and print the result.Input
Tag names; then the text.
Output
One line.
Sample 1
Input
b i hello
Output
<b><i>hello</i></b>
Sample 2
Input
p x
Output
<p>x</p>
Output appears here