f | import re | f | import re |
n | pattern = input() | n | regex = input() |
| while (line := input()): | | while (s := input()): |
| match = re.search(pattern, line) | | res = re.search(regex, s) |
| if match is None: | | if res is None: |
| print('<NONE>') | | print('<NONE>') |
| else: | | else: |
t | print(f'{match.start()}: {match.group()}') | t | print(f'{res.start()}: {res.group()}') |
| for idx, sub in enumerate(match.groups()): | | for i, gr in enumerate(res.groups()): |
| if sub: | | if gr: |
| print(f'{idx + 1}/{match.start(idx + 1)}: {sub}') | | print(f'{i + 1}/{res.start(i + 1)}: {gr}') |
| for name, sub in match.groupdict().items(): | | for name, gr in res.groupdict().items(): |
| if sub: | | if gr: |
| print(f'{name}/{match.start(name)}: {sub}') | | print(f'{name}/{res.start(name)}: {gr}') |