Skip to content

Instantly share code, notes, and snippets.

@Grissess
Created January 17, 2024 21:20
Show Gist options
  • Save Grissess/dae80edbcc0a469b0d56467f1711bea3 to your computer and use it in GitHub Desktop.
Save Grissess/dae80edbcc0a469b0d56467f1711bea3 to your computer and use it in GitHub Desktop.
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