Created
January 17, 2024 21:20
-
-
Save Grissess/dae80edbcc0a469b0d56467f1711bea3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
hosts = {} | |
for line in sys.stdin: | |
line = line.strip() | |
if not line: | |
continue | |
host, pkg = line.split() | |
hosts.setdefault(pkg, set()) | |
hosts[pkg].add(host) | |
for pkg in hosts: | |
first = True | |
for host in hosts[pkg]: | |
init = f'{pkg}: ' | |
print(f'{init if first else " "*len(init)}{host}') | |
first = False | |
print() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment