Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- forum_dict = {}
- while True:
- forum = input()
- if forum == "filter":
- break
- topic = forum.split(" -> ")[0]
- tag_list = forum.split(" -> ")[1].split(", ")
- if topic in forum_dict.keys():
- forum_dict[topic].extend(tag_list)
- else:
- forum_dict[topic] = tag_list
- data = input().split(", ")
- for key, value in forum_dict.items():
- unique_tag_list = sorted(set(value), key=value.index) #запазва input ordera без да разбърква set-a
- forum_dict[key] = unique_tag_list
- data_set = set(data)
- if data_set.issubset(unique_tag_list):
- print(f"{key} | #{', #'.join(unique_tag_list)}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement