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