[Question]
  [
## 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: "Cb-Ad"**
* The first letter is a "**C**". We should do a rotation to the left, but there's no character before this "**C**". So, there's nothing to rotate.
* The next letter is a "**b**". We rotate "**C**" to the right. Because it's a single character, it is left unchanged.
* The character "**-**" does not trigger any rotation, as it's not a letter.
* The next letter is a "**A**". We rotate "**Cb-**" to the left, which gives "**b-C**Ad"
* The fourth and last letter is a "**d**". We rotate "**b-CA**" to the right, which gives "**Ab-C**d"
Therefore, the expected output is "**Ab-Cd**".
## 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](/questions/tagged/ogl-edocf "show questions tagged 'ogl-edocf'")~~ [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'")
## Test cases
```
"cbad" -> "abcd"
"ACBD" -> "ABCD"
"Cb-Ad" -> "Ab-Cd"
"caeBDF" -> "aBcDeF"
"aEcbDF" -> "abcDEF"
"ogl-edocf" -> "code-golf"
"W o,ollelrHd!" -> "Hello, World!"
"ti HIs SSta ET!" -> "tHis IS a tEST!"
```
  
[Answer]
# Pyth, ~~21~~ 20 bytes
```
VQ=k+.>k-}NG}Nr1GN)k
```
[Try it here](http://pyth.herokuapp.com/?code=VQ%3Dk%2B.%3Ek-%7DNG%7DNr1GN%29k&input=%22W+o%2CollelrHd%21%22&debug=0)
### Explanation
```
VQ=k+.>k-}NG}Nr1GN)k
VQ                )      For each N in the input...
     .>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.
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~100~~ ~~98~~ 95 bytes
```
f=lambda s,p='':s and f(s[1:],[p[x:]+p[:x]+s[0]for x in[s[0].isupper()-s[0].islower()]][0])or p
```
[Try it online!](https://tio.run/##TYw9b4MwFEX3/opXOiQouGo7ImUATERmKmWwPPiLBMnlWbar0l9PiUAp473n3Ot@4w2Hj2nqjlZ8SS0gZO642@UBxKCh2wf2nvOMOTbm/OBYPvJDYG@8Qw8j9AO7h9c@fDtn/D4la7T4c4@czzGdVTc53w9x/kuUFDpJ4QUSIZVOnh6gqEq6gKKs6AZUkhTrpJCk2m6UMCU9rXeloua0gaJW8gGlovUW4tUSo1F1C1eoDbmi7TbKBTBDa431jX5etMZYixlc0Nu5@ldjD805QNtGAfXnKsemD3BuQUCs27mc/gA "Python 2 – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 14 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
ØẠŒHċ€ḅ-N⁸ṙ;ð/
```
A monadic link accepting a list of characters which yields a list of characters.
**[Try it online!](https://tio.run/##ATcAyP9qZWxsef//w5jhuqDFkkjEi@KCrOG4hS1O4oG44bmZO8OwL////yJ0aSBISXMgU1N0YSBFVCEi "Jelly – Try It Online")** Or see the [test-suite](https://tio.run/##y0rNyan8///wjIe7Fhyd5HGk@1HTmoc7WnX9HjXueLhzpvXhDfr/j@453A4Udv//P1opOSkxRUmHS0HJ0dnJBcxwTtJ1hAglJ6Y6ubiBmYmuyUlQZn56jm5qSn5yGpgXrpCvk5@Tk5pT5JGiCBYpyVTw8CxWCA4uSVRwDVFUigUA "Jelly – Try It Online").
### How?
```
ØẠŒHċ€ḅ-N⁸ṙ;ð/ - Link - list of characters
             / - reduce by:
            ð  -   a dyadic chain:  1st call is f(L=1stCharacter, R=2ndCharacter)
               -                    ...then calls are f(L=previousResult, R=nextCharacter)
ØẠ             -     alphabet characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
  ŒH           -     split in half = ["ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz"]
     €         -     for each:
    ċ          -       count occurrences (of R)
               -                          e.g.: 'W' -> [1,0]; 'c' -> [0,1]; '@' -> [0,0]
      ḅ-       -     convert from base -1             -1             1             0
        N      -     negate                            1            -1             0
         ⁸     -     chain's left argument (i.e. L)
          ṙ    -     rotate left by (the negate result)
           ;   -     concatenate R
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~18~~ ~~17~~ ~~16~~ 14 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
õsvy.uy.l-._y«
```
[Try it online](https://tio.run/##yy9OTMpM/f//8Nbiskq90kq9HF29@MpDq///L8lU8PAsVggOLklUcA1RBAA) or [verify all test cases](https://tio.run/##yy9OTMpM/W/h5ulir6TwqG2SgpL9/8Nbi8sq9Uor9XJ09eIrD63@X6vzPzkpMYXL0dnJhcs5SdcxhSs5MdXJxY0r0TU5CUjlp@fopqbkJ6dxhSvk6@Tn5KTmFHmkKHKVZCp4eBYrBAeXJCq4higCAA).
**Explanation:**
```
õ            # Start with an empty string
 sv          # Loop over the characters `y` of the input
   y.u       #  Check if `y` is an uppercase letter (1 if truthy; 0 if falsey)
   y.l       #  Check if `y` is a lowercase letter (1 if truthy; 0 if falsey)
      -      #  Subtract them from each other
       ._    #  Rotate the string that many times (-1, 0, or 1) toward the left
   y«        #  Append the current character `y` to the string
             # (And implicitly output the string after the loop)
```
[Answer]
# [K4](http://kx.com/download/), ~~43~~ 33 bytes
**Solution:**
```
""{.q.rotate[-/y in'.Q`A`a;x],y}/
```
**Examples:**
```
q)k)""{.q.rotate[-/y in'.Q`A`a;x],y}/"Cb-Ad"
"Ab-Cd"
q)k)""{.q.rotate[-/y in'.Q`A`a;x],y}/"ogl-edocf"
"code-golf"
q)k)""{.q.rotate[-/y in'.Q`A`a;x],y}/"ti HIs SSta ET!"
"tHis IS a tEST!"
```
**Explanation:**
Iterate over the input string, rotating the previous output by 1, -1 or 0 depending upon it's position in the list "a-zA-Z".
```
""{.q.rotate[-/y in'.Q`A`a;x],y}/ / the solution
""{                            }/ / iterate (/) over, starting x as ""
                             ,y   / append y to
   .q.rotate[             ;x]     / rotate x by ...
                    .Q`A`a        / the lists "a..z" and "A..Z"
               y in'              / y in each (') alphabet?
             -/                   / subtract (-) over (/)
```
**Notes:**
* -10 bytes with inspiration from the [05AB1E](https://codegolf.stackexchange.com/a/172462/69200) solution
[Answer]
# [><>](https://esolangs.org/wiki/Fish), ~~45~~ 43 bytes
```
ii:2+7$.::&"`{"@)@(*?}"@["&::&@)@(*?{&!
ror
```
[Try it online!](https://tio.run/##S8sszvj/PzPTykjbXEXPykpNKaFayUHTQUPLvlbJIVpJDSgE4VarKXIV5Rf9/x@ukK@Tn5OTmlPkkaIIAA "><> – Try It Online")
The fact that ><> has stack rotation helps, but having to check the case of the letter doesn't.
### Explanation:
```
i    Get first inputted character
 i   Get second. This is to prevent errors from rotating an empty stack
  :2+7$.      Jump to the second line if that was EOF
        ::&   Create copies of the input and store one in the register
           "`{"@)@(*     Check if the char is lower case
                    ?}   If so rotate the stack
                      "@["&::&@)@(*?{   Rotate the other way if uppercase
                                     &  Push the new char
                                      ! Skip the first i instruction
Skip to the second line on EOF
ro      Reverse the stack and output
r r     Cancel out the first reverse
 o      Output the rest of the stack
```
[Answer]
# [Haskell](https://www.haskell.org/), ~~101~~ 91 bytes
-10 bytes inspired by [Curtis Bechtel's answer](https://codegolf.stackexchange.com/a/172481/48198) (use `'@'<c,c<'['` over `elem c['A'..'Z']` and the according range for lower-cased letters).
```
g(x:y)=foldl((<>pure).(!))[x]y
x@(a:b)!c|'`'<c,c<'{'=last x:init x|'@'<c,c<'['=b++[a]|0<1=x
```
[Try it online!](https://tio.run/##bZFBb@IwEIXv/IohF2xBou4VkWpDQkWl9pSVKhWh1dgegrUmRokRyYr/zk6CVPWwPsz4fe/N@OAjtn/Iubs9nX0ToMCAybuvvTUgQKyeJch7JbplL9ODd8YJZudLQzIRUyl33b6fdD8FLpWc6hs5OoHezXCWJLO/s33qsA3QLW1tuX3Z2WB/sq3m8x3ub0@rH2l3P6GtIYUTnt9/gzhfQhmatxoSqDyXhtBI7s7W1EK6WkFFIfd1oDq0cD1SQxMYoqJb9BJuUEEHaQo9r2yP/spqPocI4mcufBtZzyNf5wY@8JqrbYlnogNaR2b5Lf2/DYKfkQ8uGFycAUXfh/rRlNFdRFqhiRYRKm0iORFRlq8L1tk6L0adqzgbApmK80dCI62Ll2FmrQt6GRlutHowpYvNg/nKxWS8PjDW3lBceXcYnQ/wC@8cuWZrpuxu@a/9Aj5841gPiWBh@9pCWQaEza8hE7a2hdcSEMKmZCL/AQ "Haskell – Try It Online")
## Explanation / Ungolfed
The operator `(!)` takes a non-empty string `x` on which we can pattern-match and a character:
```
x@(a:b) ! c
  | '`' < c, c < '{' = last x : init x  -- rotate x to the right by one
  | '@' < c, c < '[' = b ++ [a]         -- rotate x to the left by one
  | otherwise = x                       -- keep x as is
```
Now we can reduce the input's tail from the left to the right, starting with the first character of the input using:
```
\b a -> b!a ++ [a]
```
[Answer]
# [Haskell](https://www.haskell.org/), 122 92 bytes
Thanks to BWO for the suggestions! I also saved a lot by taking a slightly different approach than my original answer.
```
l@(a:b)!c|'`'<c,c<'{'=last l:init l++[c]|'@'<c,c<'['=b++[a,c]|0<1=l++[c]
f(c:s)=foldl(!)[c]s
```
[Try it online!](https://tio.run/##PYpNS8QwFEX3/RWvQUhLWtBtaWQ@ZQR3FVwMgi8vrVPm2UiTWTn/vQYmurr3nHtP6M8987LwqsDGlDld5YdsqaJW/kjN6ANwM05jDKWO9H6VqzQfpTZRYRXlffugb3s2FNT4Ug@OLRd5GZVf5ssEXn9fQhfml@nOKyUA6kcAodQAPvvCcdLWZRCPggxacavr7WaX6tbU6z9N2G92TwlwT@Yf3CfXvXU0JH4DVznmnueDzZMLIxyePXRdQNi/5mL5BQ "Haskell – Try It Online")
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), ~~116~~ 102 bytes
```
f=(s,i=1)=>s[i]?f(s.replace(RegExp(`^(.)(.{${i}})(?=[A-Z])|^(.{${i}})(.)(?=[a-z])`),"$4$3$2$1"),i+1):s
```
[Try it online!](https://tio.run/##bctPC4IwHMbxe6/CZIffj9zA6lRYWBl1rSAojOacshhNnET057UbdAli18/3eS78xq2oVdXQq8ll2xYR2EBFIUYTe1TptADLallpLiRsZJncKzifgCGwJ3mq9xthGh1jekjxdfoZ@zKnjxTPGPhkSAakT0IfA9ULcWTbsTBXa7Rk2pRQgC8ynvuInX@P57OFy@cZjZ0HweVssXQVnojMXUypqcyNKFxx75nAaC11vcq7rkGjvNXaetttw71k9520Hw "JavaScript (Node.js) – Try It Online")
## Original (~~116~~ ~~111~~ 106B)
~~`s=>Buffer(s).map((x,i)=>s=(t=s[S="slice"](i),i<2)?s:x>64&x<91?s[S](1,i)+s[0]+t:x>96&x<123?s[i-1]+s[S](0,i-1)+t:s)&&s`~~
~~`s=>Buffer(s).map((x,i)=>i<2|--x%32>25|x<64?s:s=[s[S="slice"](1,i)+s[0],s[i-1]+s[S](0,i-1)][+(x>95)]+s[S](i))&&s`~~
`s=>Buffer(s).map((x,i)=>!i|--x%32>25|x<64?s:s=(w=x>95,t=s.slice(1-w,i-w),w?s[i-1]+t:t+s[0])+s.slice(i))&&s`
[Answer]
# [Ruby](https://www.ruby-lang.org/), 51 bytes
```
->s{w=[];s.map{|x|w.rotate!(x=~/\W/||?_<=>x)<<x};w}
```
[Try it online!](https://tio.run/##Jc67DoIwAIXh3acoLKjh8gBQDDeDMyYMSExbQE1qSmgJGIqvXqtO5/u3M4z4pTqonJAvE6xqn7tP1C9ylpM7MIFEa2xn@PYupSfl4RrAcN4Fwbz606oqk2DUmLYZJXGqJ8FO9E2C2jg9aqCM4B/YjTptw0inXQJmM0pbOuSNoVs8QH7ioCgEAtnZMOv/AS43/Sg46CrukjsaeL23rFV9AA "Ruby – Try It Online")
Input and output are arrays of characters
### The trick:
The code is pretty straightforward, except perhaps the rotation part:
```
(x=~/\W/||?_<=>x)
```
x is a single character, which could be a letter, the first expression `x=~/\W/` returns `nil` if it's a letter, and 0 otherwise. If it's 0, we're done, if not, the logical `or` checks the second expression: `?_<=>x` returns -1 for upper case and 1 for lower case. So the rotation is:
* -1 (1 to the left) for upper case
* +1 (1 to the right) for lower case
* 0 (no rotation) if it's not a letter
[Answer]
# [Red](http://www.red-lang.org), 110 bytes
```
func[s][p: s forall s[if all[(a: first s)>#"@"a < #"["][move p back s]if all[a >#"`"a <#"{"][move back s p]]p]
```
[Try it online!](https://tio.run/##TcpNCsIwGIThfU8x/bpRsBcoIooIdWsFFyFg2iQSjE1IqhsPHyv@0N3MyxOUTAclGc90lfS971jkzFeI0C4IaxGZ0RgHm4kK2oQ4IM5XBa1JYImCGHF2cw8Fj1Z0V0T@9QKjOr9VQc8f@hB4zj1PPph@gAZt23IjKfv/E9zCWatsqGU@6e5iSyVdpydtMKj3EU0zCOyOOaUX "Red – Try It Online")
## Explanation:
```
f: func [ s ] [
    p: s                                ; store the starting position of the string in p
    forall s [                          ; iterate through the entire string
        a: first s                      ; store the current character in a
        if all [ a > #"@" a < #"[" ] [  ; if `a` is a uppercase letter
            move p back s               ; move the starting char to the position before current
        ]
        if all [ a > #"`" a < #"{" ] [  ; if `a` is a lowercase letter
            move back s p               ; move the character before the current one to the start
        ]
    ]
    p                                   ; return the string 
]
```
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 47 bytes
```
*.reduce:{|@$^a.rotate($^b~~/\w/&&'_'leg$b),$b}
```
[Try it online!](https://tio.run/##JYjJCoJAGIDvPsU4iEu43DokQW5hZ4MuYcwqxtgfoxFS@eqGdfqWu9BqPXcjsiXazqtQC/5gYvN676yahBoGMgjXquk0RednZNvOxVGisajnW/Qzx0ZPRiTdkEFHvfAK7Q1J0AZmlHDsGzjJ0nxhRoPkNxgRab5fjBSM/g0aFQgOTC5xQuCDUkLpkpvLGFpUHnpUVQNBxdHE8fwF "Perl 6 – Try It Online")
Works on an array of chars.
[Answer]
# Japt, ~~17~~ ~~16~~ 14 bytes
Takes input as an array of characters, outputs a string
```
;rÏiXéCøY -BøY
```
[Try it](https://ethproductions.github.io/japt/?v=1.4.6&code=O3LPaVjpQ/hZIC1C+Fk=&input=WyJDIiwiYiIsIi0iLCJBIiwiZCJd)
---
## Explanation
```
 rÏ                :Reduce by passing the current result (X) & the current element (Y) through a function
   i               :  Prepend to Y
    Xé             :  X rotated right by
;     B            :    Uppercase alphabet
       øY          :    Contains Y?
          -        :    Subtract
;          C       :    Lowercase alphabet
            øY     :    Contains Y?
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 19 bytes
```
W€ḷṙ01ŒlƑ?-ŒuƑ?};ʋ/
```
[Try it online!](https://tio.run/##y0rNyan8/z/8UdOahzu2P9w508Dw6KScYxPtdY9OKgVStdanuvX///@vlJ@eo5uakp@cpgQA "Jelly – Try It Online")
[Answer]
# Java 10, ~~149~~ 119 bytes
```
s->{for(int i=1;i<s.length();)s=s.replaceAll("^(.)(.{"+i+"})(?=[A-Z])|^(.{"+i+++"})(.)(?=[a-z])","$4$3$2$1");return s;}
```
Port of [*@ShieruAsakoto* JavaScript answer](https://codegolf.stackexchange.com/a/172463/52210), so make sure to upvote him.
[Try it online.](https://tio.run/##XZHfSsMwGMXv9xSfoRcJXQNT72qV7o/MC3dTQXBskKbZzMzS0qQDnbv1AXxEX6R2XQS7m5D8zsfhnC8btmPBJnuruWLGwCOTet8DkNqKcsW4gNnxCZDYUuo1cOwuhoQNP/Saw1hmJYcZaIigNsHtfpWXuHEAGQ1CeWOoEnptXzEJiYkMLUWhGudYKYyWmBJM98iXPjoQfBfN4@BlQT6XDvotpq3Cgo8FQX3kXXtX3qU3QCQsha1KDSY81OExSlGlqoniEu1ymcG2aeRCzxfAyKmOFcZixFOWobbIH4lHw3GXjNIgPhviTAzH913GJjw9Z/laBSLL@aqLnyHv50oJVU6zi65kJUwfDCSJZTB5cuL/JbeV2ln3D1IXlXWlkndjxZbmlaVFI1qlcSv7CH6@vgH5mvITIc74UP8C)
**Explanation:**
```
s->{                          // Method with String as both parameter and return-type
  for(int i=1;i<s.length();)  //  Loop `i` in the range [1, length)
    s=s.replaceAll("^(.)(.{"+i+"})(?=[A-Z])|^(.{"+i+++"})(.)(?=[a-z])","$4$3$2$1");
                              //   Rotate the substring of [0, i] either left or right
  return s;}                  //  Return the modified input-String as result
```
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 32 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
éG7[Æ┐äZ▬Θε♫∙~╞ÉH╔u╬←J╛ü╢(┼▒uX)Ü
```
[Run and debug it](https://staxlang.xyz/#p=8247375b92bf845a16e9ee0ef97ec69048c975ce1b4abe81b628c5b17558299a&i=cbad%0AACBD%0ACb-Ad%0AcaeBDF%0AaEcbDF%0Aogl-edocf%0AW+o,ollelrHd%21%0Ati+HIs+SSta+ET%21&m=2)
```
B]s{c97 123:bsaa|)sc65 91:bsaa|(s+c}fd  #Full program, unpacked, implicit input
B]s                                     #Unons-left, singleton, swap top 2 of stack
   {c                                   #Copy iterative letter
     97 123                             #Put 97 and 123 on stack(lower case)
           :bsaa                        #Check if iterative letter is between range, swap orientation back to proper order
                |)                      #Rotate if the letter is within range
                  sc                    #Swap top 2 and copy top
                    65 91               #Put 65 and 91 on stack (Capitals)
                         :bsaa          #Check if iterative letter is between range, swap orientation back to proper order
                              |(        #Rotate if the letter is within range
                                s+c     #swap, concat and copy
                                   }fd  #remove duplicate of original answer after loop and implicitly print
```
A lot of stack swapping which is probably unnecessary. I really would like to get this down more, but I was strugging with the ordering of the stack. Maybe somebody can figure it out if they are bored. Will keep working on it.
[Answer]
# [Attache](https://github.com/ConorOBrien-Foxx/Attache), 69 bytes
```
~Fold[{s'r.=_'sp;Rotate[s,&`-!Has&r[0]=>ALPHA'alpha]+r}@SplitAt]#Iota
```
[Try it online!](https://tio.run/##JYrBasMwEAXv/grZLfGhduk5xaWKk@BACSE25CBEu5bWiUFUQru30v66E6enN28YYAZzwWkQy2r623pn1Q/l8bn6zCm8Hj0Do6Ji8VWmDdAiqhddvcmPQyNzcOEC@in@vrfBjSxZP@xu/bRHtKQeQzBnnRzi@M0dEtdASGoohEoy04PNiiST9Wo9b92X8i4M4Gq9nQk2pv8nf3YlWm@G@ZyEL7xz6GJj01nwKJodibZlEJsuzRKtpys "Attache – Try It Online")
## Explanation
### General shape
The function looks generally like this:
```
~Fold[{...}]#Iota
```
Which folds `{...}` over each member in the range from `0` to `#input - 1` (`Iota`), starting with the input as a seed.
### The inner function
The following function is called as `f[building, index]` and is called with each index from `0` to `#input` exclusive. `@SplitAt` calls `SplitAt` on these arguments, splitting the input string on `index`.
```
{s'r.=_'sp;Rotate[s,&`-!Has&r[0]=>ALPHA'alpha]+r}
{                                               }    anonymous function taking the split string
                                                     e.g.: ["cd-", "Adf!"]
      _'sp                                           concat the input with a space
                                                     e.g.: ["cd-", "Adf!", " "]
                                                     (this is to handle index = 0)
 s'r.=                                               `s` is the first member, and `r` is the second
           Rotate[s,                         ]       rotate `s` by:
                                  ALPHA'alpha          over uppercase and lowercase alphabets:
                        Has&r[0]=>                       test if r[0] is in each alphabet
                                                       e.g.: [true, false]
                    &`-!                               subtract the second from the first
                                                       e.g.: (true - false) = 1 - 0 = 1
                                                     s is rotated according to the following map:
                                                       uppercase =>  1
                                                       symbol    =>  0
                                                       lowercase => -1
                                              +r     append the right portion of the string
```
Essentially, this function rotates the left portion of the string according to the first character of the right portion.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 20 bytes
```
ＦＳ≔⁺⭆ω§ω⁻⁺λ№αι№βιιωω
```
[Try it online!](https://tio.run/##NYzBCsIwEETv/Yr1toH4BZ6KCOZQKMQfSFutC2FTkk3r38e04mFg3sww49vFMThfyitEQMNLFiuReEaloE2JZsbe54S/tHMLbhpaMTw9P7vtiGt7TLyGa8gs6DSQUn8aDtqZqjZ1afp6JVhdKUJwNwmsFQe3x6kp59V/AQ "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
ＦＳ
```
Loop over the input characters.
```
≔⁺⭆ω§ω⁻⁺λ№αι№βιιω
```
Map over the string of collected characters so far, cyclically indexing into the collected characters so far with the index incremented or decremented if the current character is upper or lower case respectively. This completes the rotation. The next character is then concatenated, and the result assigned back to the string.
```
ω
```
Print the result.
[Answer]
# [R](https://www.r-project.org/), ~~107~~ ~~102~~ 100 bytes
Massive because R's string manip is bulky. Can anyone get it under 100?
-5 bytes using the "set loop variables to F to avoid initializing" trick.
-2 bytes by assuming all characters are printable and using `2*!k%%97>25` rather than `2*k%in%97:122` for testing lower case, using operator precedence.
```
function(x){for(k in u<-utf8ToInt(x))u[1:F-1]=u[(1:(F=F+1)+k%in%65:90-2*!k%%97>25)%%F];intToUtf8(u)}
```
[Try it online!](https://tio.run/##TYxNa8IwAEDv@xWxI9BMA6vgNjsV@hXaczs8iIckTSQ0JFATGIz99q6rVLy@93j9IHd4kN5wp6wJv9GPtH3YAWWA32Hv5EdjK@NGgfwpigmOznt/CqM4JHuyjNCyg8rAt028fcXrl0UH4fb9sN4gCMn5UxnX2K/xEXr0O8gw4Iy2AXoG@AACyngbPI0wydJ8hkma5RPMGE7uacJwdms5FWlO7ouU54JMghacPQjG8@Im7EVj0VouZ8dtK/DFajnpI7Arq7XQfdku5qQUWtsVONpej/A/cwqU1RXUtaOgaO6hK9UVVDWgwBX1iIc/ "R – Try It Online")
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~25~~ 23 bytes
*I give up, Can't make it shorter*
-2 bytes from @ETHproductions
```
£=¯Y éXè\a -Xè\A)+UsYÃU
```
---
```
£=¯Y éXè\a -Xè\A)+UsYÃU     Full program. Implicit input U
£                           map each char
 =                          set U equal to:
  ¯Y                        U sliced to current mapped value
    éXè\a -Xè\A)            and rotated left or right 1 char
                +UsY        append the non-sliced U value
                      ÃU    Output U    
```
[Try it online!](https://ethproductions.github.io/japt/?v=2.0a0&code=oz2vWSDpWOhcYSAtWOhcQSkrVXNZw1U=&input=WyJjYmFkIiwKIkFDQkQiLAoiQ2ItQWQiLAoiY2FlQkRGIiwKImFFY2JERiIsCiJvZ2wtZWRvY2YiLAoiVyBvLG9sbGVsckhkISIsCiJ0aSBISXMgU1N0YSBFVCEiXSAtbVI=)
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), ~~67~~ ~~64~~ 58 bytes
```
^
¶
+`(.*)(.)¶([a-z])|(.)(.*)¶([A-Z])|¶(.)
$2$1$3$5$4$6$7¶
```
-9 bytes thanks to @Neil removing the three unnecessary `?` I had added, as well as the unnecessary `(.*)` in the else-case.
[Try it online](https://tio.run/##K0otycxLNPz/P47r0DYu7QQNPS1NDT3NQ9s0ohN1q2I1a4AckBhIwFE3CigAZOlpcqkYqRiqGKuYqpiomKmYH9r2/39JpoKHZ7FCcHBJooJriCIA) or [verify all test cases](https://tio.run/##K0otycxLNPyvquGe8D@O69A2Lu0EDT0tTQ09zUPbNKITdatiNWuAHJAYSMBRNwooAGTpaXKpGKkYqhirmKqYqJipmB/a9h@o@39yUmIKl6OzkwuXc5KuYwpXcmKqk4sbV6JrchKQyk/P0U1NyU9O4wpXyNfJz8lJzSnySFHkKslU8PAsVggOLklUcA1RBAA). (NOTE: Outputs with a trailing newline. The header in the test suite is to test each input-line as a separate test case, and the footer is to remove that trailing newline for a more compact output.)
**Explanation:**
Prepend a newline before the input:
```
^
¶
```
Continue replacing as long as we can find a match:
```
+`
```
Everything else is three different checks merged together:
If the character right after the newline is lowercase letter: rotate everything before the newline once towards the right, and then append that character and the newline:
```
(.*)(.)¶([a-z])
$2$1$3¶
```
If the character right after the newline is an uppercase letter: rotate everything before the newline once towards the left, and then append that character and the newline:
```
(.)(.*)¶([A-Z])
$2$1$3¶
```
Else (neither a lowercase nor uppercase letter): simply shift the newline once towards the right for the next 'iteration':
```
¶(.)
$1¶
```
These three checks above are merged with regex OR statements (`|`) and larger group-replacements to make it act like an `if(lowercase) ... elseif(uppercase) ... else ...`:
[Answer]
# [MATL](https://github.com/lmendo/MATL), 20 bytes
```
ttYo-ZS"X@q:&)w@YSwh
```
[Try it online!](https://tio.run/##FYhLCsIwEED3PcXUhYNgLuCqn1TiOgVbQXDyUQsjQR3o8WNcvc@LhPNtmUwWmZO62M3UvA/b3drMdn3mqx4zekcBK2z7Thf0TrX/9BQ7fSxCg3dFoML0YBVD8vdyz5D2iTnyx4S6tCxgTl@wVgiGscYf "MATL – Try It Online")
-4 bytes thanks to Luis Mendo.
Converts uppercase/lowercase/non-letter to [-1,0,1] (first half of the program). Applies circshift consecutively (second half). I'm wrecking my brain if there's a better way to map uppercase/lowercase to [-1,0,1] (see the second version), and perhaps a way to reverse the string right away so as to get rid of the two `w`'s needed for the `&)`.
[Answer]
# [C (clang)](http://clang.llvm.org/), ~~168~~ ~~159~~ ~~153~~ 119 bytes
```
g,i,j;f(char*a){for(i=0;a[j=i++];islower(a[i])?g=a[j],bcopy(a,a+1,j),*a=g:isupper(a[i])?g=*a,bcopy(a+1,a,j),a[j]=g:0);}
```
-26 thanks to @ceilingcat
[Try it online!](https://tio.run/##VZBPT4MwGIfP8inqvBQoZl5FNM65zPNMdiAcXvqPkkoJFI1Z9tmxBMbw1t/7PM37a2lENVSy7yVRpIwFpgU0AfgnYRqsknUMaZmoMMxi1WrzwxsMqcr8F5k4kJGcmvoXA4HwgZQ@CSCRj6rt6nohBnDRnASDNlx14tqPz/2dqqjuGEdPrWXK3BfPnqcqi75AVfjbKOafvJuhFIIN3fJdmqEErSjwzXa3iidEDePSaDFCI3XEmaFi5pa3dmRWof1Hiw4HC@j983Y2Cq7d80yj2egdkSFGa66bPbtakNOJv@XRKxvmAo@9fHeuO9suovvMqdcMlwOBh1ozugSBr11m@H/kdroi141jOPd/ "C (clang) – Try It Online")
[Answer]
# Pyth, 16 bytes
```
em=+.>k-F}RGrBd2
```
[Try it here!](http://pyth.herokuapp.com/?code=em%3D%2B.%3Ek-F%7DRGrBd2&input=%22W+o%2CollelrHd%21%22&debug=0)
Explanation:
```
em=+.>k-F}RGrBd2dQ    Autofill variables
 m               Q    for each d in Q (the input):
            rBd2       Take [d, swapcase(d)]
         }RG           Figure out which are in the lowercase alphabet (returns [1,0] for lowercase, [0,1] for uppercase, [0,0] for non-letters)
       -F              Fold on subtraction (1 for lowercase, -1 for uppercase, 0 for non-letter)
    .>k                Cycle the processed part (k) of the input right by ^ steps
   +            d      Add in the new character at the end
  =   k                Store new process step back into k (k starts as an empty string)
e                     Get the (e)nd step's output.
```
]