C#6, 201 bytes, by milkby milk
using System.Linq; _=>string./**/ #if trueJoin (/*"*//*/""/**//*/"*/", #else Concat(//*/, #endif from m in" "let p=$@"{@" "[1]}"from i in(_.Replace(p,@""))where!new[]{p[0]^32^10}.Contains(i)select@i); trueJoin is not defined, so only string.Concat() remains.
p is "\n". p[0]^32^10 is space. It would have been (a bit) more difficult if it's p[0]^42 or other similar constants.