Rosencrantz and Guildenstern are Code In the absurdist play Rosencrantz and Guildenstern are Dead, the two main characters Rosencrantz and Guildenstern(or are they?) are always mixing up which of them is who—or sometimes which of their own body parts is which—because of a perceived lack of individual identity. Wouldn't it be absurd if they even shuffled around their names?

Your task it to write a function which takes in a string of an even length(and by design, a multiple of 4) that is greater than 7 characters, split it, and shuffle it.

The splitting shall be as follows:
the string will be of format "abscd", with s acting as a seperator character. The first section and the separator, abs will be the first half of the string, whereas the second half will be cd

The length of a will be (string length / 4) - 1

The length of b will be (string length / 4)

The length of s will be 1

The length of c will be (string length / 4) + 1

The length of d will be (string length / 4) - 1

This may be really confusing, so let me show you
with some examples

("a" + "bb" + "s" + "ccc" + "d").length //8
  1     2      1      3      1
|-------4--------|  |----4-----| &lt;--- (4 is half of 8)

("rosen" + "crantz" + "&amp;" + "guilden" + "stern").length  //24
    5         6        1        7          5

("foo" + "barr" + "?" + "barry" + "foo").length
   3       4       1      5         3


Finally:

You then shuffle the parts around, outputting adscb

ex. "rosencrantz&amp;guildenstern" --&gt; "rosenstern&amp;guildencrantz"

"foobarr?barryfoo" --&gt; "foofoo?barrybarr"

Rulez:


Standard Loopholes are prohibited
Acceptable answers: a function which takes input through one input string and returns one output string
If the input string doesn't match the requirements provided above,
your code MUST error out(doesn't matter what kind of Exception or
Error)
This is code-golf, so the shortest(valid)answer (in each language)
wins!
Bonus points for a one-liner :-) (Not really tho, just cool points)
K (oK), 35 34 33 bytes

{$[8&gt;#x;.;&lt;x!4!-&amp;4#-1 0 2+-4!#x]}


Try it online!

Without input validation (for ngn's bounty), 25 24 23 bytes

{&lt;x!4!-&amp;4#-1 0 2+-4!#x}


Try it online!

Quickly learned a bit of K and, looking at the list of verbs, I thought an alternative approach (not using cut) could work here. And it worked perfectly.

How it works

{&lt;x!4!-&amp;4#-1 0 2+-4!#x}
                 -4!#x    Length divided by four (floor division)
        4#-1 0 2+         Generate lengths (x/4-1, x/4, x/4+2, x/4-1)
       &amp;                  Generate that many 0, 1, 2, 3's
    4!-                   Negate and modulo 4; effectively swap 1 and 3
 &lt;x!                      Sort the original string by above

{$[8&gt;#x;.; &lt;code&gt; ]}  Input validation
 $[8&gt;#x           ]   If the length is less than 8
        .             Dynamically generate an error
           &lt;code&gt;     Otherwise, run the main code