← Questions

Group email logs by sender and sort them

0
StripeCodingLast asked May 2026

Each log line holds a timestamp, a sender address, a receiver address and a subject that may contain spaces or be empty. Read the lines from standard input, group them by sender, and print the senders in alphabetical order, each followed by its logs sorted by timestamp, then receiver, then subject (the sender is not repeated on the log lines). Take care parsing the subject, which is everything after the third field.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding