Skip to main content
2 of 8
added 126 characters in body
isaacg
  • 42.1k
  • 5
  • 73
  • 213

#Pyth, 120 - 20 - 15 = 85

Jm]dUzL[-bQ+bQ?tb%bQb?hb%hbQb)FNJIgNQB~Jm+NkyeN;KS{msm+@zd@S*Q<GQxsbdUzfqSsTUz^fqsmv@*QzkY/smvbzQJQ|jb<K/lKu*GhHUQ1"None

Notes:

  • Saved 10 characters by switching to newline separated input.

Test run:

pyth programs/sum_group.pyth <<< '156790809
3'
1a5a6b7c9a0b8c0c9b
    
pyth programs/sum_group.pyth <<< '156790808
3'
None

pyth programs/sum_group.pyth <<< '1221
2'
1a2a2b1b
1a2b2a1b

pyth programs/sum_group.pyth <<< '1221 2'
1a2a2b1b
1a2b2a1b

Explanation to follow.

isaacg
  • 42.1k
  • 5
  • 73
  • 213