Skip to main content
4 of 9
deleted 1 character in body
Shaggy
  • 43.5k
  • 4
  • 36
  • 94

Japt v2.0a0, 30 29 bytes

Takes input in lowercase, prepend v<space> for +2 bytes if that's not allowed.

óÍ®n îZè²gSi-i¥)òìyÈû4 Ôû6'_

Try it or run all test cases

Lots of Japt and JS trickery at play here, making it a tough explanation to write. I'll have to come back later and add a separate section explaining how the partition works as it's a difficult one - I'm not sure I fully understand it myself yet! I'll also add some more detail on why ²="p".

óÍ®n îZè²gSi-i¥)òìyÈû4 Ôû6'_     :Implicit input of string
óÍ                                :Partition into the groups we need
  ®                               :Map each Z
   n                              :   Convert to integer (the letter at the end is ignored)
     î                            :   Repeat and slice to that length
      Zè                          :     Count the occurrences in Z of
        ²                         :     "p"
         g                        :     Index into
          S                       :       Space
           i-                     :       Prepend "-"
             i¥                   :       Prepend "=="
               )                  :       End prepend
                ò                 :       Partitions of length 2
                 Ã                :End map
                  ¬               :Join
                   y              :Transpose
                    È             :Pass each row through the following function and transpose back
                     û4           :   Centre pad with spaces to length 4
                        Ô         :   Reverse ('cause centre padding is right-biased)
                         û6'_     :   Centre pad with "_" to length 6
Shaggy
  • 43.5k
  • 4
  • 36
  • 94