You are viewing a single comment's thread. Return to all comments →
Testcase fails.
Copy testcase STDIN to custom input case box.
TEST SUCCESSFUL.
WHAT GIVES!!!
Not the prettiest code, but it definitely worked:
import re n = int(input()) tag_dict = dict() RE = re.compile(r'<\w+|\w+=') for _ in range(n): html = RE.findall(input()) for i, tag in enumerate(html): if '<' in tag: key = tag[1:] tag_dict[key] = [] for attr in html[i:]: if '<' in attr and attr is not tag: break elif '=' in attr: tag_dict[key].append(attr) for key in sorted(tag_dict.keys()): print(f'{key}:{",".join(sorted([attr for attr in tag_dict[key]]))}')
Seems like cookies are disabled on this browser, please enable them to open this website
Detect HTML Attributes
You are viewing a single comment's thread. Return to all comments →
Testcase fails.
Copy testcase STDIN to custom input case box.
TEST SUCCESSFUL.
WHAT GIVES!!!
Not the prettiest code, but it definitely worked: