Reduce string to a snippet of the alphabet Given a non-empty string consisting of only lower and upper case alphabetical characters and spaces ([a-zA-Z ]), reduce it to a snippet of the alphabet, starting with the first character.

To reduce a string, begin with the first alphabetical character, then remove every character after it that is not the next letter of the alphabet. Continue doing this until you reach the end of the string.

For example codegolf:

Begin with c, remove o as it is not the next letter of the alphabet.
Keep d as it is the next letter of the alphabet, and keep e as it is the next letter too.
Remove g, o, and l, and keep f.

Your final snippet would then be cdef

Rules


Capitalisation should be maintained, so CodEgolF would result in CdEF
Space is not a letter of the alphabet, and thus should always be removed, even if it is the start of the string
Due to the nature of the reduction, the first alphabetical character of the input will always be the first character of the output.
zZ is the last letter of the alphabet. There are no letters after it, the alphabet does not loop.


Test Cases

codegolf -&gt; cdef
CodEgolf -&gt; CdEf
 codeolfg -&gt; cdefg
ProgrammingPuzzles -&gt; P
Stack Exchange -&gt; St
The quick red fox jumped over the lazy brown dog -&gt; Tuvw
Zebra -&gt; Z
Abcdegfhijkl -&gt; Abcdef


Scoring

This is code-golf, so fewest bytes in each language wins!
JavaScript (ES6), 66 79 68 67 bytes

f=([c,...s],p)=&gt;c?(p?~parseInt(c+p,36)%37:c&lt;'!')?f(s,p):c+f(s,c):''


How?

Testing consecutive letters

Because converting two characters to their ASCII codes would be a rather lengthy operation in JS, we use the following formula instead:

~parseInt(b + a, 36) % 37


Provided that both a and b are in [a-zA-Z ], the above expression equals 0 if and only if a and b are consecutive letters (i.e. consecutive digits in base 36), no matter the case of the characters.

For instance:

~parseInt("Y" + "x", 36) = ~(36 * parseInt("Y", 36) + parseInt("x", 36))
                         = ~(36 * 34 + 33)
                         = -(36 * 34 + 33 + 1)
                         = -(37 * 34)


Formatted and commented

f = ([c,                              // c = current character
         ...s],                       // s = array of remaining characters
                p) =&gt;                 // p = previous matching letter
  c ? (                               // if there's still at least 1 character to process:
      p ?                             //   if p was already defined:
        ~parseInt(c + p, 36) % 37     //     test if p and c are NON-consecutive letters
      :                               //   else:
        c &lt; '!'                       //     test if c is a space character
    ) ?                               //   if the above test passes:
      f(s, p)                         //     ignore c and keep the current value of p
    :                                 //   else:
      c + f(s, c)                     //     append c to the final result and update p to c
  :                                   // else:
    ''                                //   stop recursion


Test cases



f=([c,...s],p)=&gt;c?(p?~parseInt(c+p,36)%37:c&lt;'!')?f(s,p):c+f(s,c):''

console.log(f("codegolf")) // -&gt; cdef
console.log(f("CodEgolf")) // -&gt; CdEf
console.log(f(" codeolfg")) // -&gt; cdefg
console.log(f("ProgrammingPuzzles")) // -&gt; P
console.log(f("Stack Exchange")) // -&gt; St
console.log(f("The quick red fox jumped over the lazy brown dog")) // -&gt; Tuvw
console.log(f("Zebra")) // -&gt; Z
console.log(f("Abcdegfhijkl")) // -&gt; Abcdef