Skip to main content
4 of 8
deleted 76 characters in body
isaacg
  • 42.1k
  • 5
  • 73
  • 213

#Pyth, 126 - 20 - 15 = 91

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

Notes:

  • Saved 10 characters by switching to newline separated input.

  • Fixed a bug invloving groups not of size equal to the side length of the matrix. +6 characters.

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
isaacg
  • 42.1k
  • 5
  • 73
  • 213