Remove Spaces, Maintaining Capitalization

C (gcc), 82 79 74 72 69 67 66 bytes

f(c){for(char*s=c,*p=c;c=*s++;c&&putchar(c^(*p++|~c/2)&32))c&=95;}

Try it online!


Python 2, 114 bytes

x=input()
X=x.replace(' ','')
print''.join([X[i].upper()if x[i].isupper()else X[i].lower()for i in range(len(X))])

Try it online!

Equivalently:

Python 2, 114 bytes

lambda x:''.join([[str.lower,str.upper][x[i].isupper()](x.replace(' ','')[i])for i in range(len(x)-x.count(' '))])

Try it online!


Jelly, 14 13 bytes

nŒlTɓḲFŒlŒuṛ¦

Try it online!

How it works

nŒlTɓḲFŒlŒuṛ¦  Main link. Argument: s (string)

 Œl            Convert s to lowercase.
n              Perform character-wise "not equal" comparison.
   T           Get the indices of all truthy elements, i.e., the indices of all
               uppercase letters in s. Let's call the resulting array J.
    ɓ          Begin a dyadic chain with left argument s and right argument J.
     ḲF        Split s at spaces and flatten, removing the spaces.
       Œl      Convert s to lowercase.
            ¦  Sparse application:
         Œu        Convert s to uppercase.
           ṛ       Take the resulting items of the uppercased string at all indices
                   in J, the items of the lowercased string at all others.