n | from re import search | n | import re |
| | | |
n | regex = input() | n | reqex = input() |
| string = input() | | word = input() |
| while string: | | while (word): |
| found = search(regex, string) | | result = re.search(reqex, word) |
| if found: | | if (result): |
| print("{}: {}".format(found.start(), found.group())) | | print("{0}: {1}".format(result.start(), result.group())) |
| for j, i in enumerate(found.groups()): | | for j, i in enumerate((result.groups())): |
| if i: | | if (i): |
| print("{}/{}: {}".format(j + 1, found.start(j + 1), i)) | | print("{0}/{1}: {2}".format(j+1, result.start(j+1), i)) |
| named_groups = found.groupdict() | | gronamed = result.groupdict() |
| for i in named_groups: | | for i in (gronamed): |
| if named_groups[i]: | | if gronamed[i]: |
| print("{}/{}: {}".format(i, found.start(i), named_groups[i])) | | print("{0}/{1}: {2}".format(i, result.start(i), gronamed[i])) |
| else: | | else: |
| print("<NONE>") | | print("<NONE>") |
t | string = input() | t | word = input() |
| | | |