Skip to content

Instantly share code, notes, and snippets.

@hansrajdas
Created October 18, 2018 16:43
Show Gist options
  • Save hansrajdas/826e0dc69d725e3636313b105158996c to your computer and use it in GitHub Desktop.
Save hansrajdas/826e0dc69d725e3636313b105158996c to your computer and use it in GitHub Desktop.
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