#MATL, [<s>22</s> 21 bytes by Luis Mendo.][1] Finally... MickyT cracked it while I was writing an explanation, so his answer is the "valid" one. I posted this anyway, in accordance with [this meta post](https://codegolf.meta.stackexchange.com/a/10578/31516). --- `M` and `Y` are unnecessary and are commented out. It's enough to add 4 whitespace characters, not 5. t' @ *'dm1e5%M dw%Y ( This is equivalent to the [more compact][2]: t' @ *'dm7dw( **Partial explanation:** % Implicit input t % Duplicate input ' @ *' % String with ASCII-values [32 64 32 42] d % diff, giving [32 -32 10], 32 is space, 10 is newline m % ismember, checking if the character is 32 or 10 1e5 % 10000, but could just as well be 7 d % Taking the diff of the scalar 1e5, returning an empty matrix [] w % Swap stack in order to use ( below ( % Equivalent to x(y)=[], where x is the input string, and y is the logical % vector found using ismember (m) % Implicit output [1]: http://codegolf.stackexchange.com/a/103210/31516 [2]: http://matl.tryitonline.net/#code=dCcgQCAqICdkbTdkdyg&input=WydUaGlzIGlzICcsIDEwLCAnYScsIDEwLCAnc3RyaW5nJ10