LearnPy Hub
← Regular Expressions problems
Hard

Matching Tags

Find every <tag>…</tag> pair where the closing tag has the same name, using a backreference like <(\w+)>.*?</\1>. Print each tag name and its inner text as tag: text (or none).

Input

One line.

Output

Lines.

Sample 1

Input
<b>bold</b> and <i>italic</i>
Output
b: bold
i: italic

Sample 2

Input
<b>bad</i>
Output
none
solution.py
Output appears here
Matching Tags · Python practice problem · LearnPy Hub