Advertisement
AlexG2230954

Контрольная. Задание 2

May 28th, 2022
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. from collections import Counter
  2.  
  3.  
  4. if __name__ == "__main__":
  5.     pairs = []
  6.  
  7.     while True:
  8.         line = input()
  9.         if line == "0": break
  10.         first_part, second_part = line.split(", ")
  11.         authors = first_part.split()
  12.         temi = second_part.split()
  13.  
  14.         for a in authors:
  15.             for t in temi:
  16.                 pairs.append((a, t))
  17.  
  18.     counter = Counter(pairs)
  19.     maximum = counter.most_common(1)[0][1]
  20.    
  21.     for pair in counter.most_common():
  22.         if pair[1] == maximum:
  23.             print(pair[0])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement