An ogl-edocf challenge Input
A non-empty shuffled string consisting of ASCII characters in the range \$[32..126]\$.
Output
The output is obtained by applying successive rotations to the input string.
For each letter ([a-zA-Z]) in the input string, going from left to right:

if the letter is in upper case, rotate all characters before it by one position to the left
if the letter is in lower case, rotate all characters before it by one position to the right

Example
Input: &quot;Cb-Ad&quot;

The first letter is a &quot;C&quot;. We should do a rotation to the left, but there's no character before this &quot;C&quot;. So, there's nothing to rotate.
The next letter is a &quot;b&quot;. We rotate &quot;C&quot; to the right. Because it's a single character, it is left unchanged.
The character &quot;-&quot; does not trigger any rotation, as it's not a letter.
The next letter is a &quot;A&quot;. We rotate &quot;Cb-&quot; to the left, which gives &quot;b-CAd&quot;
The fourth and last letter is a &quot;d&quot;. We rotate &quot;b-CA&quot; to the right, which gives &quot;Ab-Cd&quot;

Therefore, the expected output is &quot;Ab-Cd&quot;.
Rules

You may take input as a string or as an array of characters -- which may or may not be the same thing, depending on your language.
You may also output an array of characters instead of a string.
This is ogl-edocf code-golf

Test cases
&quot;cbad&quot; -&gt; &quot;abcd&quot;
&quot;ACBD&quot; -&gt; &quot;ABCD&quot;
&quot;Cb-Ad&quot; -&gt; &quot;Ab-Cd&quot;
&quot;caeBDF&quot; -&gt; &quot;aBcDeF&quot;
&quot;aEcbDF&quot; -&gt; &quot;abcDEF&quot;
&quot;ogl-edocf&quot; -&gt; &quot;code-golf&quot;
&quot;W o,ollelrHd!&quot; -&gt; &quot;Hello, World!&quot;
&quot;ti HIs SSta ET!&quot; -&gt; &quot;tHis IS a tEST!&quot;
Pyth, 21 20 bytes

VQ=k+.&gt;k-}NG}Nr1GN)k


Try it here

Explanation

VQ=k+.&gt;k-}NG}Nr1GN)k
VQ                )      For each N in the input...
     .&gt;k                 ... rotate k (initially '')...
        -}NG}Nr1G        ... by (N is lowercase) - (N is uppercase)...
    +            N       ... then append N...
  =k                     ... and update k.
                   k     Output the result.