fork download
  1. import re
  2. import sys
  3.  
  4. file = sys.stdin
  5. tokens = iter(re.split(r'(^Clutch\d{3}\s*$)\s+', file.read(), flags=re.M))
  6. next(tokens) # skip until the first Clutch
  7. print({k: ', '.join(v.splitlines()) for k, v in zip(tokens, tokens)})
Success #stdin #stdout 0.01s 7900KB
stdin
Clutch001
Albino X Pastel
Bumble Bee X Albino Lesser
Clutch002
Bee X Fire Bee
Albino Cinnamon X Albino
Mojave X Bumble Bee
Clutch003
Black Pastel X Banana Ghost Lesser
stdout
{'Clutch001': 'Albino X Pastel, Bumble Bee X Albino Lesser', 'Clutch002': 'Bee X Fire Bee, Albino Cinnamon X Albino, Mojave X Bumble Bee', 'Clutch003': 'Black Pastel X Banana Ghost Lesser'}