Advertisement
viligen

company_users

Nov 7th, 2021
809
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. companies = {}
  2.  
  3. while True:
  4.     data = input().split(" -> ")
  5.     if "End" in data:
  6.         break
  7.     company, id = data
  8.     if company not in companies:
  9.         companies[company] = []
  10.     if id not in companies[company]:
  11.         companies[company].append(id)
  12.  
  13. for k, v in sorted(companies.items()):
  14.     print(f"{k}\n"+'\n'.join(["-- "+s for s in v]))
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement