Created
October 18, 2018 16:43
-
-
Save hansrajdas/826e0dc69d725e3636313b105158996c to your computer and use it in GitHub Desktop.
Problem description - https://drive.google.com/file/d/1pIfAEW6DLZdlBZVgNvnikPDLlz2y-nyD/view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections | |
def club_logs_by_uuid(logs): | |
logs_by_uuid = collections.defaultdict(list) | |
for log in logs: | |
logs_by_uuid[log.split(' ')[2]].append(log) | |
return logs_by_uuid | |
def main(): | |
raw_logs = [] | |
while True: | |
try: | |
raw_logs.append(raw_input()) | |
except: | |
break | |
clubbed_logs = club_logs_by_uuid(raw_logs) | |
for uuid in sorted(clubbed_logs.keys()): | |
for log in clubbed_logs[uuid]: | |
print log | |
print "" # Extra line between each group | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment