Difficult task for an interview at Meta (Facebook)

Hi there,

I have a problem with this task with Python code.

Alex was asked to mark up a huge number of pictures. Looking at the deadline and at a huge number of pictures of pictures, Alex realized that he did not have time to do everything himself. However, he had many, many friends who were ready to help him! He gave each of his friends a certain number of tasks in order to label the pictures together.
Not all of Alex's friends are conscientious and considerate performers. However, Alex is not just Alex either; Alex - was an analyst and came up with the idea that you need to give each task to several friends, and as an answer to the task to believe - the most frequently encountered answer.
Help Alex restore the final answers to the problem based on the verdicts of your friends.

Input form.
On each input line (an unknown number of lines), you are given the verdict of one friend for one of the tasks in the format separated by a space:
<worker_id> <task_id>
where <worker_id> is some string that uniquely identifies a friend, <task_id> is a string that uniquely identifies the task, and is some integer that is responsible for the answer to the task

Output form.
As an answer to the problem, you need to display the verdicts for the problem on separate lines:
<task_id>
<task_id> from separated by a space
Important, when outputting <task_id> must be sorted in ascending lexicographic order.

Important: if there are several most frequently encountered answers to the problem, choose the answer with the smallest value.
Moreover, verdicts can be not only 0 or 1

Comments (2)