LearnPy Hub
← Context Managers problems
Easy

Nested Tags

Using a context manager tag(name) (any style) that prints <name> on entry and </name> on exit, nest the tags given on the input line from outer to inner and print the word text in the middle.

Input

A line of tag names.

Output

The nested tags.

Sample 1

Input
html body p
Output
<html>
<body>
<p>
text
</p>
</body>
</html>

Sample 2

Input
b
Output
<b>
text
</b>
solution.py
Output appears here
Nested Tags · Python practice problem · LearnPy Hub